Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use jquery simple modal plugin to edit form data in zend framework?
    primarykey
    data
    text
    <p>I am developing a simple students information application. I have student list in my index.phtml and I can edit student information form there. It's working nice but I want to use modal for edition student info. But I don't know how to do this.Below I have posted my current codes :</p> <p>/// indexController.php</p> <pre><code>public function editAction() { $modelStudents = new Application_Model_DbTable_Students(); $id = (int) $this-&gt;_getParam('id'); $student = $modelStudents-&gt;fetch($id); $form = new Application_Form_Student($student-&gt;email); $form-&gt;submit-&gt;setLabel('Save'); $this-&gt;view-&gt;form = $form; if ($this-&gt;getRequest()-&gt;isPost()) { $formData = $this-&gt;getRequest()-&gt;getPost(); if ($form-&gt;isValid($formData)) { $id = (int)$form-&gt;getValue('id'); $name = $form-&gt;getValue('name'); $email = $form-&gt;getValue('email'); $phone = $form-&gt;getValue('phone'); $students = new Application_Model_DbTable_Students(); $students-&gt;updateStudent($id, $name, $email, $phone); $this-&gt;_helper-&gt;redirector('index'); } else { $form-&gt;populate($formData); } } else { $id = $this-&gt;_getParam('id', 0); if ($id &gt; 0) { $form-&gt;populate($modelStudents-&gt;getStudent($id)); } } } </code></pre> <p>/// index.phtml</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type="text/css" rel="stylesheet"&gt; &lt;/style&gt; &lt;script type="text/javascript" src="jQuery.js"&gt; &lt;/script&gt; &lt;script type ="text/javascript" src="jquery.simplemodal-1.4.2.js" &gt;&lt;/script&gt; &lt;script&gt; &lt;?php echo "Student List"; ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo $this-&gt;url(array('controller'=&gt;'index', 'action'=&gt;'add'));?&gt;"&gt;Add new student&lt;/a&gt;&lt;/p&gt; &lt;table border="1"&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Email&lt;/th&gt; &lt;th&gt;Phone&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;?php foreach($this-&gt;students as $student) : ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $student-&gt;name;?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $student-&gt;email;?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $student-&gt;phone;?&gt;&lt;/td&gt; &lt;td&gt; &lt;a href="&lt;?php echo $this-&gt;url(array('controller'=&gt;'index', 'action'=&gt;'edit', 'id'=&gt;$student-&gt;id));?&gt;"&gt;Edit&lt;/a&gt; &lt;a href="&lt;?php echo $this-&gt;url(array('controller'=&gt;'index', 'action'=&gt;'delete', 'id'=&gt;$student-&gt;id));?&gt;"&gt;Delete&lt;/a&gt; &lt;p id="delete" &gt; Delete &lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach; ?&gt; &lt;/table&gt; &lt;/center&gt; &lt;/html&gt; </code></pre> <p>////edit.phtml</p> <pre><code>&lt;center&gt; &lt;?php echo "Edit Student List "; echo $this-&gt;form ; ?&gt; &lt;/center&gt; </code></pre> <p>Please let me know how to use jQuery simple modal plugin to preform this task. Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload