I have resorted to using scriptlets. There must be a more elegant solution
though!

<logic:iterate id="searchField" type="package.SearchField" 
name="<%=Constants.SEARCH_FIELD_KEY %>">
<tr>
        <td><bean:write name="searchField" property="displayName" /></td>
        <td><input type="text" name="<%= searchField.getId() %>" 
value="<%=searchField.getValue() %>"></td></tr>        </logic:iterate>which 
gives...<tr>      <td>First name</td>     <td><input type="text" name="firstName" 
value=""></td></tr>     <tr>    <td>Last name</td>      <td><input type="text" 
name="lastName" value=""></td></tr>      cheersA         > -----Original Message-----> 
From: Andrew Paul Swift [mailto:[EMAIL PROTECTED]]> Sent: 26. juni 2001 
12: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> 


---------------------------------------------------------------------
To send us encrypted mail, please refer to:
http://www.millionhandshakes.com/emailpolicy/pgp.html

Million Handshakes

Reply via email to