There are quite a few messages in the archive about this:

   http://www.mail-archive.com/struts-user%40jakarta.apache.org/

You have a choice - use scriptlets to generate an appropriate name with the
index of the row or create custom versions of struts tags which do it. We
choose the later.

Martin Cooper recently added and indexId scripting variable which can help
you with this - message in the archice about this is:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg09767.html

An example thread this was discussed:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg07656.html
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg07767.html

Also Dave Hay posted some updated Struts tags which generate the name
appropriately (havent looked at them myself):

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10006.html


Niall

> -----Original Message-----
> From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]]
> Sent: 26 June 2001 11:25
> To: '[EMAIL PROTECTED]'
> Subject: Form problem
>
>
> I have an array beans which I am trying to use to build up a dynamic form.
> The bean has 3 properties DisplayName, id and value.
>
> The id property is the unique identifier that corresponds to the
> name of the
> HTML input field.
> The value property contains the value of the HTML text field.
> The displayName property contains the name that should be
> displayed next to
> the form field.
>
> so... I iterate through the array and build up the form
>
> <logic:iterate id="searchField" type="package.SearchField"
> name="<%=Constants.SEARCH_FIELD_KEY %>">
>                       <tr>
>                               <td><bean:write
> name="searchField"property="displayName" /></td>
>                               <td><html:text
> name="searchField"property="id" /></td>
>                       </tr>
> </logic:iterate>
>
> which produces this output ...
>
> <tr>
>       <td>FORNAVN</td>
>       <td><input type="text" name="id" value="FIRSTNAME"></td>
> </tr>
> <tr>
>       <td>LASTNAME</td>
>       <td><input type="text" name="id" value="LASTNAME"></td>
> </tr>
>
> but... the HTML name attribute is always "id" which means that I can't
> identify the individual fields.
> I want the name attribute of the HTML input field to be the value
> stored in
> beans id property!
>
> n.b. I have no control over what the search fields may be. I just have to
> handle whatever I get.
>
>
> Any ideas??
>
> cheers
>
>
> Andrew
>
>
> ---------------------------------------------------------------------
> To send us encrypted mail, please refer to:
> http://www.millionhandshakes.com/emailpolicy/pgp.html
>
> Million Handshakes
>

Reply via email to