Hi,

I have a field called "Preferred Zip codes : ". The user is provided with 10
textfields for this to enter.
He may enter  1 or more and submit the form. If any of the zip codes that he
entered is not in my
database, I need to change the border color of that textfield containing
incorrect zip code alone to red and
show the form back to user.

How do I do this using Struts 2.1.6. I already know in my action class about
the incorrect field. In JSP I have
constructed text fields using <s:iterator> with value as dummy string array
of size 10. Everything looks good.

How to connect the error in action to the field on the screen (Again the
field is constructed using S:Itertaor>).

 Any help on this appreciated.

Here is the code snippet..
String[] zipCode = new zipCode[10];

<s:iterator value="zipCodeList" var="Zcode" status="rowstatus">
                    <td align="center">
                        <s:textfield
                        required="true" name="zipCode" id="%{'zipCode[' +
(#rowstatus.index) + ']'}"
                        value="%{Zcode}" cssClass="textbox" required="true"
                        size="5" theme="simple"/>
                    </td>
                    <s:if test="((#rowstatus.index + 1) %6) == 0">
                        </tr>
                        <tr>
                    </s:if>

</s:iterator>

Thanks,
JB

Reply via email to