Hi All,
Planning to create a dynamic form using struts2(similar to
http://www.phpform.org/formbuilder/index.php).
Say I have following headings
Create a Label (heading 1)
It will display text field to enter label text and 'Add Label'
button
Create a Text Field( heading 2)
It will display text field to enter type (text, telephone,zip
etc)
It will display text field to enter size of text field
entry(this will be the maximum length of textfield) and 'Add Text Field' button
Whenever we press button it will show a row in user form. say I have
following form created dynamically
<form id="form-details" name="newForm" onsubmit="return true;"
action="/form.action" method="POST">
<table width="99%" cellpadding="0" cellspacing="0">
<tr>
<td>
<label> First Name </label>
</td>
<td>
<input type="text" title="text" name="field1" size="50" />
</td>
</tr>
<tr>
<td>
<label> Last Name </label>
</td>
<td>
<input type="text" title="text" name="field2" size="50" />
</td>
</tr>
<tr>
<td>
<label> Last Name </label>
</td>
<td>
<input type="text" title="zip" name="field3" size="5" />
</td>
</tr>
</table>
</form>
Now form is having 3 elements(field1,field2,field3)...when I submit this form
how to get following details in action class
1) How many fields are there?
2) Each field name, title and size(example: field3,zip, 5)
Please advice how to do this using strust2.
Thanks,
Sharath.