RE: validator question: show value of a field in error

2003-09-17 Thread Jean-Michel Garnier
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:[EMAIL PROTECTED]
 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
 
 


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



newbie validator question: show value of a field in error

2003-09-16 Thread Daniel Wang
I have a dumb question re: struts validator:

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

Thanks,
Daniel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: newbie validator question: show value of a field in error

2003-09-16 Thread Naveen Mudgal
u catch the username field value using bean:write tag and concatenate the error 
message defined in applicationresources.properties file errors.email={0} is not a 
valid email address.



-Original Message-
From: Daniel Wang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 3:13 PM
To: Struts Users Mailing List
Subject: newbie validator question: show value of a field in error


I have a dumb question re: struts validator:

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

Thanks,
Daniel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: newbie validator question: show value of a field in error

2003-09-16 Thread Daniel Wang
I could certainly do this by hand in the validate() method of the form or in
the action (which I have been doing this for the last few months), but I was
hoping the validator could do it for me somehow...

or maybe I misunderstood you?  obviously concatenating strings would be
bad due to i18n.

daniel

- Original Message - 
From: Naveen Mudgal [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 2:50 AM
Subject: RE: newbie validator question: show value of a field in error


 u catch the username field value using bean:write tag and concatenate
the error message defined in applicationresources.properties file
errors.email={0} is not a valid email address.



 -Original Message-
 From: Daniel Wang [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 16, 2003 3:13 PM
 To: Struts Users Mailing List
 Subject: newbie validator question: show value of a field in error


 I have a dumb question re: struts validator:

 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

 Thanks,
 Daniel


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



validator question: show value of a field in error

2003-09-16 Thread Daniel Wang
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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



validator question: show value of a field in error

2003-09-16 Thread Daniel Wang
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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]