Hi Mike
Maybe I'm simplifying it somewhat and I'm not sure of your form-bean structure,
however the outer loop should loop through 'familymembers' as it is looping it
should
set a form-bean for the inner loop identifying a 'familymember'. I also like
to add the
type here - helps my inline documentation. So, outer loop should be:
<logic:iterate name="applicationForm" property="familymembers"
id="familymember"
type="controller.form.FamilyMemberForm">
Then we can add the inner loop in a similar manner, referencing the
'familymember'
defined in the outerloop:
<logic:iterate name="familymember" id="familyitem"
type="controller.form.FamilyItemForm">
Finally we can then display the input box for these items:
<html:text name="familyItem" property="dataProperty" size="${familyItem.size}"
readonly="${familyItem.readonly}">
Maybe this is too simplistic, sorry if I've missed the point somewhere.
Kind regards
mc
On 28 Oct 2005 at 14:01, Mike Manley wrote:
> Hi,
>
> I have a problem trying to create a multi row edit form which has to be
> able to dynamically decide which columns should be displayed for edit.
> My jsp uses the code below.
>
> <logic:iterate name="applicationForm" property="familymembers"
> id="familymembers">
> <tr>
> <logic:iterate name="applicationForm" property="familyItems"
> id="formItem">
> <td>
> <logic:notEmpty name="formItem">
> <% InputItem inputItem = (InputItem)formItem; %>
> <logic:equal name="formItem" property="type"
> value="text">
> <html:text size="<%= inputItem.getSize() %>"
> readonly="<%= inputItem.isReadonly()%>" name="familymembers"
> property="<%= inputItem.getDataProperty() %>" indexed="true"/>
> </logic:equal>
> </td>
> </logic:iterate>
> </td>
> </logic:iterate>
>
> The outer iterate is the bean holding the data - in this case a list of
> family members - name, gender, date of birth. The inner iterate is the
> list of fields to be displayed for each, My problems is that when this
> is rendered as html - the index values generated use the index of the
> inner iterate not the outer one - so I get
>
> <tr>
> <td>
> <input type="text" name="familymembers[0].forename" value="">
> </td>
> <td>
> <input type="text" name="familymembers[1].surname" value="">
> </td>
> </tr>
> <tr>
> <td>
> <input type="text" name="familymembers[0].forename" value="">
> </td>
> <td>
> <input type="text" name="familymembers[1].surname" value="">
> </td>
> </tr>
>
> whereas what I want is
>
> <tr>
> <td>
> <input type="text" name="familymembers[0].forename" value="">
> </td>
> <td>
> <input type="text" name="familymembers[0].surname" value="">
> </td>
> </tr>
> <tr>
> <td>
> <input type="text" name="familymembers[0].forename" value="">
> </td>
> <td>
> <input type="text" name="familymembers[1].surname" value="">
> </td>
> </tr>
>
> I have also tried using nested:iterate as well - in which case I get
>
> <tr>
> <td>
> <input type="text" name="applicationForm[0].familymembers[0].forename"
value="">
> </td>
> <td>
> <input type="text" name="applicationForm[1].familymembers[0].surname"
value="">
> </td>
> </tr>
> <tr>
> <td>
> <input type="text" name="applicationForm[0].familymembers[1].forename"
value="">
> </td>
> <td>
> <input type="text" name="applicationForm[1].familymembers[1].surname"
value="">
> </td>
> </tr>
>
> so the familymembers index is now correct but I have an additionally
applicationForm[0] that I don't need.
>
> Basically what I want to achieve is that the inner loop is ignored for the
> purposes of
generating the indexing for the html output - but can't figure out to achieve
that without
writing my own tag.
>
> Can anyone help?
>
> Thanks
>
> Mike Manley
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>
FOCUS Computing - web design
Mob: 0415 24 26 24
[EMAIL PROTECTED]
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]