You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/07/08 20:58:51 UTC

Validation and Display Question

I am seeking some advice on the following:

I have a site which uses the validator.xml and validation.xml files, and within the jsp pages, I am using the <logic tag to display the messages.

All works great, but I want to go further with my validation.  Upon some investigating on other sites, I have noticed that some sites will actually change the text in front of textfields to a red along with a message about the error.

I would like to be able to perform this type of error display, instead of the simple message that comes from the html:messages error, which is a list of problems.

has anyone seen this done, or have any ideas where to begin with this?

Thanks,
Scott



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


Re: Validation and Display Question

Posted by BH...@powersystems.rockwell.com.
To get the error appear next to the field add the following :

<html:messages id="error" property="<FIELD_NAME>">
    <bean:write name="error" />
</html:messages>

to change the text of the field label

(if your form is a table)
...
<td <html:messages id="error"
property="<FIELD_NAME>">class="error"</html:messages>>
    Field label
</td>
<td><html:text property="<FIELD_NAME>"></td>
<td class="error">
    <html:messages id="error" property="<FIELD_NAME>">
        <bean:write name="error" />
    </html:messages>
</td>
...



                                                                           
             "Scott Purcell"                                               
             <spurcell@vertisi                                             
             nc.com>                                                    To 
                                       <us...@struts.apache.org>            
             07/08/2005 02:58                                           cc 
             PM                                                            
                                                                   Subject 
                                       Validation and Display Question     
             Please respond to                                             
               "Struts Users                                               
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           




I am seeking some advice on the following:

I have a site which uses the validator.xml and validation.xml files, and
within the jsp pages, I am using the <logic tag to display the messages.

All works great, but I want to go further with my validation.  Upon some
investigating on other sites, I have noticed that some sites will actually
change the text in front of textfields to a red along with a message about
the error.

I would like to be able to perform this type of error display, instead of
the simple message that comes from the html:messages error, which is a list
of problems.

has anyone seen this done, or have any ideas where to begin with this?

Thanks,
Scott



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