I am confused about what getter are you using for String[] zipCode = new
zipCode[10]; Is it 'getZipCode' or 'getZipCodeList'? If 'getZipCodeList'
then try this one:
<s:iterator value="zipCodeList" var="Zcode" status="rowstatus">
...
<s:set var="zipCodeErrors" value="%{fieldErrors['zipCodeList[' +
#rowstatus.index + ']']}"/>
...
</s:iterator>
james billa wrote:
>
> Alex, It is a great idea. But still I haven't got it working.
> "value="%{fieldErrors['zipCode[
>>
>> ' +
>> #rowstatus.index + ']']}"/>" - always evaluates to null. Can you think of
>> any reason why it could be so?
>>
>
>
> On Mon, Oct 12, 2009 at 3:50 PM, Alex Siman
> <[email protected]>wrote:
>
>>
>> Try to add next code:
>>
>> <s:set var="zipCodeErrors" value="%{fieldErrors['zipCode[' +
>> #rowstatus.index + ']']}"/>
>> <s:textfield ... cssStyle="%{(#zipCodeErrors != null &&
>> #zipCodeErrors.size > 0) ? 'border: 1px solid red;' : ''}" ... />
>>
>> james billa wrote:
>> >
>> > 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
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Changing-the-border-color-of-a-text-field-tp25861145p25862090.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Changing-the-border-color-of-a-text-field-tp25861145p25877861.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]