You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashok Madhavan <as...@yahoo.com> on 2003/05/16 18:49:28 UTC

Validator question

hi All,

I am using validator xml for validating my forms. 
In the case of an error i specify the global error
messages. i also want to change the color of the form
elements's display names where the error occured. I do
this with a style sheet control. The code looks
something like this :
  <tr <logic:messagesPresent> class="fieldlabel"
</logic:messagesPresent> >
    <th align="left">
      <bean:message
key="loginForm.username.displayname"/>
    </th>
    <td align="left">
      <html:text property="userName" size="30"
maxlength="30"/>
    </td>
  </tr>

but what happens is, in the case of even a error all
the form element display names have their color
changed.

How do i selectively change the color for indivudual
elements.

I am using Struts 1.1 RC1.

regards
Ashok




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Validator question

Posted by Dennis Muhlestein <de...@zserve.com>.
I think you are looking for <logic:messagesPresent 
property="thisField">...</logic:messagesPresent>

That way, it only applies if there are messages present for that field 
and not all the fields.

-Dennis

Ashok Madhavan wrote:

>hi All,
>
>I am using validator xml for validating my forms. 
>In the case of an error i specify the global error
>messages. i also want to change the color of the form
>elements's display names where the error occured. I do
>this with a style sheet control. The code looks
>something like this :
>  <tr <logic:messagesPresent> class="fieldlabel"
></logic:messagesPresent> >
>    <th align="left">
>      <bean:message
>key="loginForm.username.displayname"/>
>    </th>
>    <td align="left">
>      <html:text property="userName" size="30"
>maxlength="30"/>
>    </td>
>  </tr>
>
>but what happens is, in the case of even a error all
>the form element display names have their color
>changed.
>
>How do i selectively change the color for indivudual
>elements.
>
>I am using Struts 1.1 RC1.
>
>regards
>Ashok
>
>
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org