You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dewitte Rémi <re...@gide.net> on 2005/07/04 17:51:03 UTC

howto with validator

Hello everybody !
I have some howto questions related to validator.
I'd like to do some checks on my form :

1) in a multibox question, i'd like to check at least 2 are checked and at 
most 4.

2) I have a mapped property, I'd like to check every mymap(key) is answered.

3) I have a form property of type "java.lang.String[]", which is an array of 
names(<html:text property="names[0]"/>). I'd like to check all the names with 
usual validator features.

Is it possible with the validator or may I make it in my actionForm ?

Thanks

Rémi

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


Re: howto with validator

Posted by Dewitte Rémi <re...@gide.net>.
Thanks for the tip !
Rémi

Le Mardi 5 Juillet 2005 11:15, Nitesh Naveen a écrit :
> Well... You need not extend the validator plugin. You could write your
> custom validator class and write a method in that... For eg. You could
> specify this in your validator-rule.xml...
>
>  <validator name="whatever" classname="com.myvalidation.FieldChecks"
> method="validateWhatever"
>
> All you need to have now is a class FieldChecks in the given package and a
> method as specified. Now you have the validation. You could use this
> validation - 'whatever' - in your validation.xml
>
> HTH,
>
> Nitesh
> _____________________________
>
> Disclaimer:
> Information contained and transmitted by this e-mail is confidential,
> proprietary, and legally privileged data of Cordiant Technologies that is
> intended for use only by the addressee. If you are not the intended
> recipient, you are notified that any dissemination, distribution, or
> copying of this e-mail is strictly prohibited and you are requested to
> delete this e-mail immediately and notify the originator. Any views
> expressed by an individual do not necessarily reflect the view of Cordiant
> Technologies. The recipient should scan this email and any attachments for
> viruses as Cordiant Technologies is not liable for the presence of viruses
> in this email. Cordiant Technologies does not accept liability for any
> errors or omissions as the internet communications cannot be guaranteed to
> be timely, secure, error or virus-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete.
>
> To know more about Cordiant Technologies, please visit
> http://www.cordiant.com
> _____________________________
>
>
> -----Original Message-----
> From: Dewitte Rémi [mailto:remi@gide.net]
> Sent: Tuesday, July 05, 2005 4:36 PM
> To: Struts Users Mailing List
> Subject: Re: howto with validator
>
>
> Ok thanks, i'll try to achieve with the validator-rule.xml. But if i can't
> you
> suggest me to extends the plugin validator to include more specific rules,
> didn't you ?
>
> Rémi
>
> Le Mardi 5 Juillet 2005 07:45, Nitesh Naveen a écrit :
> > You could do this with validator and indexed properties.
> > When using indexed properties, JavaScript validations doesn't work.
> > However the server side validations does. This should suffice what you
> > need... In case you have some validations that involve business logic,
> > you could add more validations, customize the validator-rule.xml add
> > your own validation there point it to a custom validator method in the
> > validator you have coded.
> >
> >
> > HTH,
> >
> > Nitesh
> > _____________________________
> >
> > Disclaimer:
> > Information contained and transmitted by this e-mail is confidential,
> > proprietary, and legally privileged data of Cordiant Technologies that
> > is intended for use only by the addressee. If you are not the intended
> > recipient, you are notified that any dissemination, distribution, or
> > copying of this e-mail is strictly prohibited and you are requested to
> > delete this e-mail immediately and notify the originator. Any views
> > expressed by an individual do not necessarily reflect the view of
> > Cordiant Technologies. The recipient should scan this email and any
> > attachments for viruses as Cordiant Technologies is not liable for the
> > presence of viruses in this email. Cordiant Technologies does not
> > accept liability for any errors or omissions as the internet
> > communications cannot be guaranteed to be timely, secure, error or
> > virus-free as information could be intercepted, corrupted, lost,
> > destroyed, arrive late or incomplete.
> >
> > To know more about Cordiant Technologies, please visit
> > http://www.cordiant.com _____________________________
> >
> >
> > -----Original Message-----
> > From: Dewitte Rémi [mailto:remi@gide.net]
> > Sent: Monday, July 04, 2005 9:21 PM
> > To: Struts Users Mailing List
> > Subject: howto with validator
> >
> >
> > Hello everybody !
> > I have some howto questions related to validator.
> > I'd like to do some checks on my form :
> >
> > 1) in a multibox question, i'd like to check at least 2 are checked
> > and at most 4.
> >
> > 2) I have a mapped property, I'd like to check every mymap(key) is
> > answered.
> >
> > 3) I have a form property of type "java.lang.String[]", which is an
> > array of
> >
> > names(<html:text property="names[0]"/>). I'd like to check all the
> > names with usual validator features.
> >
> > Is it possible with the validator or may I make it in my actionForm ?
> >
> > Thanks
> >
> > Rémi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


RE: howto with validator

Posted by Nitesh Naveen <ni...@cordiant.net>.
Well... You need not extend the validator plugin. You could write your
custom validator class and write a method in that... For eg. You could
specify this in your validator-rule.xml...

 <validator name="whatever" classname="com.myvalidation.FieldChecks"
method="validateWhatever"

All you need to have now is a class FieldChecks in the given package and a
method as specified. Now you have the validation. You could use this
validation - 'whatever' - in your validation.xml

HTH,
 
Nitesh
_____________________________

Disclaimer: 
Information contained and transmitted by this e-mail is confidential,
proprietary, and legally privileged data of Cordiant Technologies that is
intended for use only by the addressee. If you are not the intended
recipient, you are notified that any dissemination, distribution, or copying
of this e-mail is strictly prohibited and you are requested to delete this
e-mail immediately and notify the originator. Any views expressed by an
individual do not necessarily reflect the view of Cordiant Technologies. The
recipient should scan this email and any attachments for viruses as Cordiant
Technologies is not liable for the presence of viruses in this email.
Cordiant Technologies does not accept liability for any errors or omissions
as the internet communications cannot be guaranteed to be timely, secure,
error or virus-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete. 

To know more about Cordiant Technologies, please visit
http://www.cordiant.com
_____________________________


-----Original Message-----
From: Dewitte Rémi [mailto:remi@gide.net] 
Sent: Tuesday, July 05, 2005 4:36 PM
To: Struts Users Mailing List
Subject: Re: howto with validator


Ok thanks, i'll try to achieve with the validator-rule.xml. But if i can't
you 
suggest me to extends the plugin validator to include more specific rules, 
didn't you ?

Rémi

Le Mardi 5 Juillet 2005 07:45, Nitesh Naveen a écrit :
> You could do this with validator and indexed properties.
> When using indexed properties, JavaScript validations doesn't work. 
> However the server side validations does. This should suffice what you 
> need... In case you have some validations that involve business logic, 
> you could add more validations, customize the validator-rule.xml add 
> your own validation there point it to a custom validator method in the 
> validator you have coded.
>
>
> HTH,
>
> Nitesh
> _____________________________
>
> Disclaimer:
> Information contained and transmitted by this e-mail is confidential, 
> proprietary, and legally privileged data of Cordiant Technologies that 
> is intended for use only by the addressee. If you are not the intended 
> recipient, you are notified that any dissemination, distribution, or 
> copying of this e-mail is strictly prohibited and you are requested to 
> delete this e-mail immediately and notify the originator. Any views 
> expressed by an individual do not necessarily reflect the view of 
> Cordiant Technologies. The recipient should scan this email and any 
> attachments for viruses as Cordiant Technologies is not liable for the 
> presence of viruses in this email. Cordiant Technologies does not 
> accept liability for any errors or omissions as the internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free as information could be intercepted, corrupted, lost, 
> destroyed, arrive late or incomplete.
>
> To know more about Cordiant Technologies, please visit 
> http://www.cordiant.com _____________________________
>
>
> -----Original Message-----
> From: Dewitte Rémi [mailto:remi@gide.net]
> Sent: Monday, July 04, 2005 9:21 PM
> To: Struts Users Mailing List
> Subject: howto with validator
>
>
> Hello everybody !
> I have some howto questions related to validator.
> I'd like to do some checks on my form :
>
> 1) in a multibox question, i'd like to check at least 2 are checked 
> and at most 4.
>
> 2) I have a mapped property, I'd like to check every mymap(key) is 
> answered.
>
> 3) I have a form property of type "java.lang.String[]", which is an 
> array of
>
> names(<html:text property="names[0]"/>). I'd like to check all the 
> names with usual validator features.
>
> Is it possible with the validator or may I make it in my actionForm ?
>
> Thanks
>
> Rémi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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



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


Re: howto with validator

Posted by Dewitte Rémi <re...@gide.net>.
Ok thanks, i'll try to achieve with the validator-rule.xml. But if i can't you 
suggest me to extends the plugin validator to include more specific rules, 
didn't you ?

Rémi

Le Mardi 5 Juillet 2005 07:45, Nitesh Naveen a écrit :
> You could do this with validator and indexed properties.
> When using indexed properties, JavaScript validations doesn't work. However
> the server side validations does.
> This should suffice what you need...
> In case you have some validations that involve business logic, you could
> add more validations, customize the validator-rule.xml add your own
> validation there point it to a custom validator method in the validator you
> have coded.
>
>
> HTH,
>
> Nitesh
> _____________________________
>
> Disclaimer:
> Information contained and transmitted by this e-mail is confidential,
> proprietary, and legally privileged data of Cordiant Technologies that is
> intended for use only by the addressee. If you are not the intended
> recipient, you are notified that any dissemination, distribution, or
> copying of this e-mail is strictly prohibited and you are requested to
> delete this e-mail immediately and notify the originator. Any views
> expressed by an individual do not necessarily reflect the view of Cordiant
> Technologies. The recipient should scan this email and any attachments for
> viruses as Cordiant Technologies is not liable for the presence of viruses
> in this email. Cordiant Technologies does not accept liability for any
> errors or omissions as the internet communications cannot be guaranteed to
> be timely, secure, error or virus-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete.
>
> To know more about Cordiant Technologies, please visit
> http://www.cordiant.com
> _____________________________
>
>
> -----Original Message-----
> From: Dewitte Rémi [mailto:remi@gide.net]
> Sent: Monday, July 04, 2005 9:21 PM
> To: Struts Users Mailing List
> Subject: howto with validator
>
>
> Hello everybody !
> I have some howto questions related to validator.
> I'd like to do some checks on my form :
>
> 1) in a multibox question, i'd like to check at least 2 are checked and at
> most 4.
>
> 2) I have a mapped property, I'd like to check every mymap(key) is
> answered.
>
> 3) I have a form property of type "java.lang.String[]", which is an array
> of
>
> names(<html:text property="names[0]"/>). I'd like to check all the names
> with
> usual validator features.
>
> Is it possible with the validator or may I make it in my actionForm ?
>
> Thanks
>
> Rémi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


RE: howto with validator

Posted by Nitesh Naveen <ni...@cordiant.net>.
You could do this with validator and indexed properties.
When using indexed properties, JavaScript validations doesn't work. However
the server side validations does.
This should suffice what you need...
In case you have some validations that involve business logic, you could add
more validations, customize the validator-rule.xml add your own validation
there point it to a custom validator method in the validator you have coded.


HTH,
 
Nitesh
_____________________________

Disclaimer: 
Information contained and transmitted by this e-mail is confidential,
proprietary, and legally privileged data of Cordiant Technologies that is
intended for use only by the addressee. If you are not the intended
recipient, you are notified that any dissemination, distribution, or copying
of this e-mail is strictly prohibited and you are requested to delete this
e-mail immediately and notify the originator. Any views expressed by an
individual do not necessarily reflect the view of Cordiant Technologies. The
recipient should scan this email and any attachments for viruses as Cordiant
Technologies is not liable for the presence of viruses in this email.
Cordiant Technologies does not accept liability for any errors or omissions
as the internet communications cannot be guaranteed to be timely, secure,
error or virus-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete. 

To know more about Cordiant Technologies, please visit
http://www.cordiant.com
_____________________________


-----Original Message-----
From: Dewitte Rémi [mailto:remi@gide.net] 
Sent: Monday, July 04, 2005 9:21 PM
To: Struts Users Mailing List
Subject: howto with validator


Hello everybody !
I have some howto questions related to validator.
I'd like to do some checks on my form :

1) in a multibox question, i'd like to check at least 2 are checked and at 
most 4.

2) I have a mapped property, I'd like to check every mymap(key) is answered.

3) I have a form property of type "java.lang.String[]", which is an array of

names(<html:text property="names[0]"/>). I'd like to check all the names
with 
usual validator features.

Is it possible with the validator or may I make it in my actionForm ?

Thanks

Rémi

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



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