struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Michel Garnier <Jean-Michel.Garn...@biomedcentral.com>
Subject RE: Validation and errormessage?
Date Wed, 24 Sep 2003 10:27:07 GMT
This point has been raised many times in the struts users mailing list (you
can search in the list with
http://nagoya.apache.org/eyebrowse/SearchList?listName=struts-user@jakarta.a
pache.org)

I forward you my reply to Daniel who had the same problem as us one week
ago. I was suggesting to collaborate in order to find an elegant solution
which could be included in the Struts Validator.

Anyone interested ?

Jean-Michel

---
We want to do exaclty the same. After many attempts, it seems that Struts
1.1 Validator does not provide this functionality.

It seems that there will be an evolution in Struts 1.2 with the validwhen
validator, see :
"Designing Complex Validations with validwhen",
http://jakarta.apache.org/struts/userGuide/dev_validator.html
and
http://jakarta.apache.org/struts/api/org/apache/struts/validator/validwhen/V
alidWhen.html

We are (will be) using intensively the Struts Validator and we do need this
feature as soon as possible.
If there are other people interested, maybe we can work together on the
subject.

First, let's write a short technical spec document, write a test class and
then implement it !
As far I am concerned, we just need to extend FieldChecks to add the value
of the field in the ActionError.

Let me know what you think.

Jean-Michel

> -----Original Message-----
> From: Daniel Wang [mailto:ddwang@anomaly.net]
> Sent: 16 September 2003 22:13
> To: Struts Users Mailing List
> Subject: validator question: show value of a field in error
> 
> 
> I asked this earlier and did not receive any response, so 
> i'll post it one
> more time with more supporting info...
> 
> In validation.xml, how do I show the value of the offending 
> field in the
> error message as
> opposed to the field name?
> 
> i.e. if the field I want to validate is email, and the user 
> types in "foo",
> how do I show
> "'foo' is not a valid email address"
> 
> as opposed to the more standard (or widely documented) error
> "'Email Address' is not valid"
> 
> In my current validation.xml, here's the relevant portion:
>               <field property="email"
>                      depends="required,email">
>                   <msg
>                     name="required"
>                     key="errors.required"/>
>                   <msg
>                     name="email"
>                     key="errors.bad.email"/>
> 
>                   <arg0 key="testForm.email"/>
>               </field>
> 
> 
>  Thanks,
> Daniel

> -----Original Message-----
> From: Terje Hopsø [mailto:tehosubs@broadpark.no]
> Sent: 24 September 2003 10:22
> To: Struts Users Mailing List
> Subject: Validation and errormessage? 
> 
> 
> Hello,
>  
> In my validation.xml I have the folowing:
>  
>    <form name="nySkytterForm">
>      <field property="epost"
>        depends="required,email">
>         <arg0 key="nySkytterForm.epost"/>
>      </field>
>    </form>
> 
> This works fine and the value from the "nySkytterForm.epost" 
> is found in the
> resources file. But I would like to have the value of the fields in my
> errormessage as well, is that possible? And if it is, how?
>  
> - Terje
> 



________________________________________________________________________
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
________________________________________________________________________

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


Mime
View raw message