Hi,

I've constructed a webpage for users to enter personal data into.

It's organized as a table with a number of rows each representing a person
and the columns containing the attributes like email first name and so on.

like this:

email firstname lastname affiliation
email firstname lastname affiliation
email firstname lastname affiliation
email firstname lastname affiliation


and so on.

the problem is that the user must be able to enter more rows if needed. say,
i start out with 4 rows but if the user needs more rows to enter information
he clicks the 'add' button and a new row is added to the page dymaivally
using DOM.

my question is:

How do i construct a zend_form to handle this and an action to extract the
data?

i suppose something like this:

form:

   private function getPaperDataForm() {
      $form = new Zend_Form();
      $form->setAction('savepaper')->setMethod('post')->setAttrib('id',
'savepaper'); 

      $email = new Zend_Form_Element_Text('email[]');
      $email->setLabel('email')->addFilter($filterTrim);
      $form->addElement($email);

and likewise with the other attributes.

      $submit = new Zend_Form_Element_Submit('save');
      $submit->setLabel('Submit');
      $form->addElement($submit);
      return $form;
   }


i think i need to have the name containing [] in order to receive the data
as an array.

i've tried to write the html directly in the view page like this:

<form id="savepaper" enctype="application/x-www-form-urlencoded"
action="/druid/registrant/savepaper" method="post">
  <table>

     <tr>
        <td><input type="text" name="email[]"  value="" /></td>
        <td><input type="text" name="firstname[]"  value="" /></td>
        <td><input type="text" name="lastname[]"  value="" /></td>
        <td><input type="text" name="affiliation[]"  value="" /></td>
     </tr>
          <tr>
        <td><input type="text" name="email[]"  value="" /></td>
        <td><input type="text" name="firstname[]"  value="" /></td>
        <td><input type="text" name="lastname[]"  value="" /></td>
        <td><input type="text" name="affiliation[]"  value="" /></td>
     </tr>
          <tr>
        <td><input type="text" name="email[]"  value="" /></td>
        <td><input type="text" name="firstname[]"  value="" /></td>
        <td><input type="text" name="lastname[]"  value="" /></td>
        <td><input type="text" name="affiliation[]"  value="" /></td>
     </tr>
          <tr>
        <td><input type="text" name="email[]"  value="" /></td>
        <td><input type="text" name="firstname[]"  value="" /></td>
        <td><input type="text" name="lastname[]"  value="" /></td>
        <td><input type="text" name="affiliation[]"  value="" /></td>
     </tr>
<tr>
<td id="save-label">&nbsp;</td><td>
<input type="submit" name="save" id="save" value="Submit" /></td>
</tr>
  </table>


</form>

but it still doesn't work.

i've tried all sorts of things but i dont receive any data back in my
action.

does anybody have anyknowledge on ho to solve this?

thanks in advance

kim
-- 
View this message in context: 
http://www.nabble.com/variable-number-of-table-rows-and-zend-form-Action-tp26078671p26078671.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to