struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hgos...@csc.com.au
Subject Re: Validator-How to put the fields value in the resulting error message?
Date Wed, 04 Feb 2004 00:05:40 GMT
I think you have to do this in code in your form's validate method.

errors.add(new ActionError("errors.email"), emailAddress);

I could be wrong but this is the way that I do it anyway... I'm not sure 
if the struts validator can do this using an expression like you have 
tried to do. 

Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779
----------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.
----------------------------------------------------------------------------------------





"David Erickson" <derickson@cmcflex.com>
04/02/2004 10:56 AM
Please respond to "Struts Users Mailing List"

 
        To:     "Struts Mailing List" <struts-user@jakarta.apache.org>
        cc: 
        Subject:        Validator-How to put the fields value in the resulting error message?


Hey all, still new with the validator.. I'm using the emailAddress 
validator
and I just want it to put the value of the field in the error message if 
its
not valid.. ie:
blah!blah.com is not a valid email address.

however I can't seem to make that happen.. here's what I've tried:
<form name="/getPassword">

<field property="userName" depends="required">

<arg0 key="User Name" resource="false"/>

</field>

<field property="emailAddress" depends="required,email">

<arg0 key="${emailAddress}" resource="false"/>

</field>

</form>

and in my properties file

errors.email=<li>{0} is an invalid e-mail address.</li>



Thanks,

David


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


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message