Re: Validator validWhen
On 2/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Thank you for your reply. Why is it only server-side ? Because no-one has written the equivalent functionality in JavaScript. Validwhen uses antlr to evaluate expressions on the server side - replicating its functionality in JavaScript would be probably be difficult. I think if you were looking to provide that kind of validation for both client and server side then it would be easier to start afresh and not use antlr. Niall [1] http://www.antlr.org/ Regards, Selon Niall Pemberton <[EMAIL PROTECTED]>: > No its server-side only. > > Niall > > On 2/27/07, jmpdev <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I would like to know if it is possible to call validWhen on the client > > side? > > > > I didn't find validWhen.js is it possible to find it somewhere? > > > > Thanks, > > > > Regards, Jean-Marie. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator validWhen
Thank you for your reply. Why is it only server-side ? Regards, Selon Niall Pemberton <[EMAIL PROTECTED]>: > No its server-side only. > > Niall > > On 2/27/07, jmpdev <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I would like to know if it is possible to call validWhen on the client > > side? > > > > I didn't find validWhen.js is it possible to find it somewhere? > > > > Thanks, > > > > Regards, Jean-Marie. > > - > 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: Validator validWhen
No its server-side only. Niall On 2/27/07, jmpdev <[EMAIL PROTECTED]> wrote: Hi, I would like to know if it is possible to call validWhen on the client side? I didn't find validWhen.js is it possible to find it somewhere? Thanks, Regards, Jean-Marie. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validator validWhen
Hi, I would like to know if it is possible to call validWhen on the client side? I didn't find validWhen.js is it possible to find it somewhere? Thanks, Regards, Jean-Marie.
Re: struts validator | validwhen rule not working
validwhen is server side only. Niall On 3/16/06, Partha Pratim Dutta <[EMAIL PROTECTED]> wrote: > I am using struts validator framework for client side & server side > validations. I am facing issue with validwhen rule. Validator rules like > 'required', 'minlength', 'maxlength' are working fine. > > The form has 2 fields > > 1. Radio button - 'currentMember'. This has values "yes" & "no". > 2. Text field - 'memberNumber'. > > I am trying to apply following validations on the above fields > > 1. memberNumber field should not be blank when the value of the > currentMember is "yes" > 2. memberNumber field should be blank when the value of > currentMember is "no". > > I have added following code in validation.xml to achieve the above > validation rule. > > > > > test > (((*this* != null) and (currentMember == > "yes")) or (*this* == null)) > > > > > I have also added registrationForm.memberNumber key in > MessageResources.properties. > > The validwhen rule is not working for any field in the form. > > If I view the source of generated html, I am not able to find validation > specific to 'memberNumber'. > > Please let me know if you have a solution to this problem. > > Thanks > PD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts validator | validwhen rule not working
I am using struts validator framework for client side & server side validations. I am facing issue with validwhen rule. Validator rules like 'required', 'minlength', 'maxlength' are working fine. The form has 2 fields 1. Radio button - 'currentMember'. This has values "yes" & "no". 2. Text field - 'memberNumber'. I am trying to apply following validations on the above fields 1. memberNumber field should not be blank when the value of the currentMember is "yes" 2. memberNumber field should be blank when the value of currentMember is "no". I have added following code in validation.xml to achieve the above validation rule. test (((*this* != null) and (currentMember == "yes")) or (*this* == null)) I have also added registrationForm.memberNumber key in MessageResources.properties. The validwhen rule is not working for any field in the form. If I view the source of generated html, I am not able to find validation specific to 'memberNumber'. Please let me know if you have a solution to this problem. Thanks PD
Please enhance validator "validwhen" to avoid associative braces
I'm using validwhen rule and find great for complex validation I'm just frustrated on the requirement to use braces to group conditions by pairs : I must make a 4 element "or" validation, each element beeing itself a "and" expression. I'd like to write test = (A and B) or (C and D) or (E and F) or (G and H) I have to write an ugly : (A and B) or ((C and D) or ((E and F) or (G and H))) doesn't look so ugly here, but A, B, C... are themself long lines Is there any way to enhance walidwhen antlr grammar in future version to support non braces expressions ? Nico. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using checkbox value in Validator validwhen test
Yes, it is cleared in the reset method of the session-scoped bean. I'm pretty methodical about that. Is my syntax ok? Ken -Original Message- From: Michael J. [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 19, 2005 4:33 PM To: Struts Users Mailing List Subject: Re: Using checkbox value in Validator validwhen test It is a classic. Look on Ted Husted's website for tip. Basically, you need to clear checkbox value each time in the reset() method of a form bean, because cleared value is not sent to server. So you think that you cleared it, but it is still set (do you use session-scoped form bean?) Michael Jouravlev. On 4/19/05, Dornback, Ken <[EMAIL PROTECTED]> wrote: > Problem: I don't know how to test a checkbox setting in the validwhen > test var-value. > > I have a checkbox and a text field. I only need to validate the text > field when the checkbox is checked. I cannot get this to work using > validwhen (other validwhens do work that use different types of tests). > It always requires the text field value be supplied regardless of the > checkbox setting. The checkbox sets the options.EMailConfig.enabled > property (The enabled field in the code does have a getter - > isEnabled()). Here is the xml I've tried: > > depends="validwhen"> > > > > > > test > > ((options.EMailConfig.enabled == null) or > (*this* != null)) > > > > > > I've also tried !options.EMailConfig.enabled for and it also fails. > Thanks. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using checkbox value in Validator validwhen test
It is a classic. Look on Ted Husted's website for tip. Basically, you need to clear checkbox value each time in the reset() method of a form bean, because cleared value is not sent to server. So you think that you cleared it, but it is still set (do you use session-scoped form bean?) Michael Jouravlev. On 4/19/05, Dornback, Ken <[EMAIL PROTECTED]> wrote: > Problem: I don't know how to test a checkbox setting in the validwhen > test var-value. > > I have a checkbox and a text field. I only need to validate the text > field when the checkbox is checked. I cannot get this to work using > validwhen (other validwhens do work that use different types of tests). > It always requires the text field value be supplied regardless of the > checkbox setting. The checkbox sets the options.EMailConfig.enabled > property (The enabled field in the code does have a getter - > isEnabled()). Here is the xml I've tried: > > depends="validwhen"> > > > > > > test > > ((options.EMailConfig.enabled == null) or > (*this* != null)) > > > > > > I've also tried !options.EMailConfig.enabled for and it also fails. > Thanks. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using checkbox value in Validator validwhen test
Problem: I don't know how to test a checkbox setting in the validwhen test var-value. I have a checkbox and a text field. I only need to validate the text field when the checkbox is checked. I cannot get this to work using validwhen (other validwhens do work that use different types of tests). It always requires the text field value be supplied regardless of the checkbox setting. The checkbox sets the options.EMailConfig.enabled property (The enabled field in the code does have a getter - isEnabled()). Here is the xml I've tried: test ((options.EMailConfig.enabled == null) or (*this* != null)) I've also tried !options.EMailConfig.enabled for and it also fails. Thanks.
validator validwhen and quotes causes js errors
It seems hard to believe that no one ran across this before, but it appears that it's not possible to specify quotes in the criteria used for validwhen. I tried to use a criteria that looks like this: ((somefield == "foo") or (*this* < 123)) However that caused javascript errors on the page because the quotes don't get escaped in any way. I tried using a backslash to escape them, but the backslash itself gets escaped. I'm thinking that one workaround might be to change each quote character into this sequence: " + '"' + " which will probably get the javascript working, but I have a feeling that the java validwhen parser won't like that much. Not to mention that doing that would make the criteria unreadable. Is anyone else having this problem? Also, the nbaPointGuard example on the validator user's guide page is wrong. It has a '>' character when it should have '>'. Anyway, after all that, I realized that I can't do what I want with validwhen. I want to run one validation only if another fails. There doesn't seem to be any way to do that, is there? eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator - ValidWhen
Looks to me like validwhen is working correctly. When you enter an "id" then the last name validation will always fail because id is not null. Don't you need something like the following: 1) On the "id" field check that either an "id" or "last name" have been entered: where.. errors.validwhen.id=Either an id or last name must be entered 2) On the "last name" field check that its either an "id" or "last name" have been entered: where.. errors.validwhen.lastName=Can't enter both a last name and id Niall - Original Message - From: "Daniel Kalcevich" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, October 21, 2004 4:10 PM Subject: RE: Struts Validator - ValidWhen I have upgraded to 1.2.4 and the problem still exists. I swapped out the .jar files, the .tld files, and verified that the .xml files were using the correct dtd. Any other ideas about what I might be able to check? Thanks. Daniel -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 20, 2004 6:33 PM To: Struts Users Mailing List Subject: Re: Struts Validator - ValidWhen Version 1.2.1 of Struts had problems and never made "ga" release quality - the only "ga" release for Struts 1.2 is Version 1.2.4 - some validwhen issues were fixed in that release. http://struts.apache.org/acquiring.html Niall - Original Message - From: "Daniel Kalcevich" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, October 20, 2004 8:10 PM Subject: Struts Validator - ValidWhen Hello, I have a form that contains two fields: id & lastName. The rule is that if I can only enter in one or the other, not both. I am trying to use the ValidWhen to perform this check. I have code similar to the following: test ((lastName == null) and (*this* != null)) minlength 10 mask ^[a-zA-Z0-9]*$ test ((id == null) and (*this* != null)) When I enter in only a value into the "id" field, I still get the message "Please enter a last name". That message is the key "errors.lastName.entry". Any ideas on what else I need to do to get this working? I am using version 1.2.1. Thanks in advance. -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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Validator - ValidWhen
I have upgraded to 1.2.4 and the problem still exists. I swapped out the .jar files, the .tld files, and verified that the .xml files were using the correct dtd. Any other ideas about what I might be able to check? Thanks. Daniel -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 20, 2004 6:33 PM To: Struts Users Mailing List Subject: Re: Struts Validator - ValidWhen Version 1.2.1 of Struts had problems and never made "ga" release quality - the only "ga" release for Struts 1.2 is Version 1.2.4 - some validwhen issues were fixed in that release. http://struts.apache.org/acquiring.html Niall - Original Message - From: "Daniel Kalcevich" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, October 20, 2004 8:10 PM Subject: Struts Validator - ValidWhen Hello, I have a form that contains two fields: id & lastName. The rule is that if I can only enter in one or the other, not both. I am trying to use the ValidWhen to perform this check. I have code similar to the following: test ((lastName == null) and (*this* != null)) minlength 10 mask ^[a-zA-Z0-9]*$ test ((id == null) and (*this* != null)) When I enter in only a value into the "id" field, I still get the message "Please enter a last name". That message is the key "errors.lastName.entry". Any ideas on what else I need to do to get this working? I am using version 1.2.1. Thanks in advance. -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]
Re: Struts Validator - ValidWhen
Version 1.2.1 of Struts had problems and never made "ga" release quality - the only "ga" release for Struts 1.2 is Version 1.2.4 - some validwhen issues were fixed in that release. http://struts.apache.org/acquiring.html Niall - Original Message - From: "Daniel Kalcevich" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, October 20, 2004 8:10 PM Subject: Struts Validator - ValidWhen Hello, I have a form that contains two fields: id & lastName. The rule is that if I can only enter in one or the other, not both. I am trying to use the ValidWhen to perform this check. I have code similar to the following: test ((lastName == null) and (*this* != null)) minlength 10 mask ^[a-zA-Z0-9]*$ test ((id == null) and (*this* != null)) When I enter in only a value into the "id" field, I still get the message "Please enter a last name". That message is the key "errors.lastName.entry". Any ideas on what else I need to do to get this working? I am using version 1.2.1. Thanks in advance. -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]
Struts Validator - ValidWhen
Hello, I have a form that contains two fields: id & lastName. The rule is that if I can only enter in one or the other, not both. I am trying to use the ValidWhen to perform this check. I have code similar to the following: test ((lastName == null) and (*this* != null)) minlength 10 mask ^[a-zA-Z0-9]*$ test ((id == null) and (*this* != null)) When I enter in only a value into the "id" field, I still get the message "Please enter a last name". That message is the key "errors.lastName.entry". Any ideas on what else I need to do to get this working? I am using version 1.2.1. Thanks in advance. -Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]