Here's an example --
<logic:iterate name="IndexedListForm" property="orders"
id="orders" indexId="ndx">
<tr>
<td>
<html:text name="orders" property="partNumber" indexed="true"/><br />
<html:messages id="error" property='<%="orders["+ndx+"].partNumber"%>'>
<font color="red"><bean:write name="error"/></font>
</html:messages>
</td>
<td>
<html:text name="orders" property="quantity" indexed="true"/><br />
<html:messages id="error" property='<%="orders["+ndx+"].quantity"%>'>
<font color="red"><bean:write name="error"/></font>
</html:messages>
</td>
</tr>
</logic:iterate>
Enjoy!
Bill Siggelkow
Milind Rao wrote:
I have googled and searched the mailing list, but couldn't find an answer to this.
I have a DynaValidatorForm containing a collection of objects presented using the logic:iterate tag in the JSP. The validation of the objects in the collection is done in the validation.xml file using something like
<field property="closeHour"
indexedListProperty= "regularTimingList"
depends="integer, intRange">
<arg0 key="error.workingHours.invalidHour" />
<arg1 name="intRange" key="${var:min}"
resource="false"/>
<arg2 name="intRange" key="${var:max}"
resource="false"/>
<var><var-name>min</var-name><var-value>0</var-value></var>
<var><var-name>max</var-name><var-value>24</var-value></var>
</field>
This creates an Action error for the property regularTiming[i].closeHour. 'i' being the index of the collection that fails validation.
What do I use for the "property" element of the "html:errors" tag? I
hardcoded a property of "regularTimingList[1].closeHour" to see if the error shows up on the page if the close hour of the 2nd item in
the collection is invalid. It does. But obviously, I don't want to
do this for every record in the collection. What I need is an
equivalent of "logic:iterate" tag for errors. Any pointers to doing
this would be appreciated.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]