RE: RE: validating a html:select box
For some reason, the javascript for intRange is not working if the property is a selection . I looked in the javascript code (I am new to that still) but I saw that it only checks for the range if the field is a text or textarea. Is this true? How can I perform the client validation for selection boxes? Change the javascript? Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 5:22 PM To: Struts Users Mailing List Subject: Re: RE: validating a html:select box Erez, In that field validation, you can overload the sentence given back on that error. After add something like: Then just add an application resource line such as: month.too.short=Please select a valid month. Or month.too.short=Please select a valid {0} to show the field name you put as arg0 in your validations xml configuration file. Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:06 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: validating a html:select box > > I guess I'd have to change the msg key to something else than the default message telling the value is out of range. What happens with html:radio? Is this also the way also to validate radio options? If no radio is selected (and I know this is off topic, well a bit) would the browser send a value? Thanks, Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 4:59 PM To: Struts Users Mailing List Subject: Re: validating a html:select box Erez, The Struts Validator has an intRange function. It's in the Validator User Guide: http://jakarta.apache.org/struts/userGuide/dev_validator.html Here's an example from that page so you can set your min & max as 1 & 12 to prevent the zero (label "month"?) from being submitted: min 10 max 20 ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 02:41 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: validating a html:select box > > I have a selection box with options where the first is valued 0 (=not selected) with some label saying: "month". How can I use the Struts validator to validate the user has actually chosen a value other than 0? Do I have to write one of my own? I wish the validwhen was around... By the way the 'birthMonth' is an int (not a string). Here is a snip of my page: Thanks a lot, Erez - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RE: validating a html:select box
I hope I am not the first one to push the limit :) because I don't think selection boxes are that rare :) -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 9:16 PM To: 'Struts Users Mailing List' Subject: RE: RE: validating a html:select box Pushing the limit, eh:). How hard is it to write your own two line JavaScript. Besides, since it's a select box(not a combo), all the options are assumed to be valid from the beginning, why there is an invalid option there:). -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 1:39 PM To: 'Struts Users Mailing List' Subject: RE: RE: validating a html:select box For some reason, the javascript for intRange is not working if the property is a selection . I looked in the javascript code (I am new to that still) but I saw that it only checks for the range if the field is a text or textarea. Is this true? How can I perform the client validation for selection boxes? Change the javascript? Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 5:22 PM To: Struts Users Mailing List Subject: Re: RE: validating a html:select box Erez, In that field validation, you can overload the sentence given back on that error. After add something like: Then just add an application resource line such as: month.too.short=Please select a valid month. Or month.too.short=Please select a valid {0} to show the field name you put as arg0 in your validations xml configuration file. Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:06 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: validating a html:select box > > I guess I'd have to change the msg key to something else than the default message telling the value is out of range. What happens with html:radio? Is this also the way also to validate radio options? If no radio is selected (and I know this is off topic, well a bit) would the browser send a value? Thanks, Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 4:59 PM To: Struts Users Mailing List Subject: Re: validating a html:select box Erez, The Struts Validator has an intRange function. It's in the Validator User Guide: http://jakarta.apache.org/struts/userGuide/dev_validator.html Here's an example from that page so you can set your min & max as 1 & 12 to prevent the zero (label "month"?) from being submitted: min 10 max 20 ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 02:41 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: validating a html:select box > > I have a selection box with options where the first is valued 0 (=not selected) with some label saying: "month". How can I use the Struts validator to validate the user has actually chosen a value other than 0? Do I have to write one of my own? I wish the validwhen was around... By the way the 'birthMonth' is an int (not a string). Here is a snip of my page: Thanks a lot, Erez - 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] - 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: RE: validating a html:select box
Pushing the limit, eh:). How hard is it to write your own two line JavaScript. Besides, since it's a select box(not a combo), all the options are assumed to be valid from the beginning, why there is an invalid option there:). -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 1:39 PM To: 'Struts Users Mailing List' Subject: RE: RE: validating a html:select box For some reason, the javascript for intRange is not working if the property is a selection . I looked in the javascript code (I am new to that still) but I saw that it only checks for the range if the field is a text or textarea. Is this true? How can I perform the client validation for selection boxes? Change the javascript? Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 5:22 PM To: Struts Users Mailing List Subject: Re: RE: validating a html:select box Erez, In that field validation, you can overload the sentence given back on that error. After add something like: Then just add an application resource line such as: month.too.short=Please select a valid month. Or month.too.short=Please select a valid {0} to show the field name you put as arg0 in your validations xml configuration file. Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:06 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: validating a html:select box > > I guess I'd have to change the msg key to something else than the default message telling the value is out of range. What happens with html:radio? Is this also the way also to validate radio options? If no radio is selected (and I know this is off topic, well a bit) would the browser send a value? Thanks, Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 4:59 PM To: Struts Users Mailing List Subject: Re: validating a html:select box Erez, The Struts Validator has an intRange function. It's in the Validator User Guide: http://jakarta.apache.org/struts/userGuide/dev_validator.html Here's an example from that page so you can set your min & max as 1 & 12 to prevent the zero (label "month"?) from being submitted: min 10 max 20 ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 02:41 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: validating a html:select box > > I have a selection box with options where the first is valued 0 (=not selected) with some label saying: "month". How can I use the Struts validator to validate the user has actually chosen a value other than 0? Do I have to write one of my own? I wish the validwhen was around... By the way the 'birthMonth' is an int (not a string). Here is a snip of my page: Thanks a lot, Erez - 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] - 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: RE: validating a html:select box
Or u can use a blank value field and use the "required" dependency in the validator... That works too, since "required" disallows blank fields.. Pras - Original Message - From: "Yansheng Lin" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Wednesday, August 06, 2003 3:15 PM Subject: RE: RE: validating a html:select box > Pushing the limit, eh:). > > How hard is it to write your own two line JavaScript. Besides, since it's a > select box(not a combo), all the options are assumed to be valid from the > beginning, why there is an invalid option there:). > > > -Original Message- > From: Erez Efrati [mailto:[EMAIL PROTECTED] > Sent: August 6, 2003 1:39 PM > To: 'Struts Users Mailing List' > Subject: RE: RE: validating a html:select box > > > For some reason, the javascript for intRange is not working if the > property is a selection . I looked in the javascript code > (I am new to that still) but I saw that it only checks for the range if > the field is a text or textarea. Is this true? How can I perform the > client validation for selection boxes? Change the javascript? > > Erez > > -Original Message----- > From: David G. Friedman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 06, 2003 5:22 PM > To: Struts Users Mailing List > Subject: Re: RE: validating a html:select box > > Erez, > > In that field validation, you can overload the sentence given back on > that error. After add something like: > > name="intRange" > key="month.invalid"/> > > Then just add an application resource line such as: > month.too.short=Please select a valid month. > Or > month.too.short=Please select a valid {0} > to show the field name you put as arg0 in your validations xml > configuration file. > > Regards, > David > > ---Original Message--- > From: Erez Efrati <[EMAIL PROTECTED]> > Sent: 08/06/03 03:06 PM > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > Subject: RE: validating a html:select box > > > > > I guess I'd have to change the msg key to something else than the > default message telling the value is out of range. > What happens with html:radio? Is this also the way also to validate > radio options? If no radio is selected (and I know this is off topic, > well a bit) would the browser send a value? > > Thanks, > Erez > > -Original Message- > From: David G. Friedman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 06, 2003 4:59 PM > To: Struts Users Mailing List > Subject: Re: validating a html:select box > > Erez, > > The Struts Validator has an intRange function. It's in the Validator > User Guide: > http://jakarta.apache.org/struts/userGuide/dev_validator.html > > Here's an example from that page so you can set your min & max as 1 & 12 > to prevent the zero (label "month"?) from being submitted: > > property="integer" > depends="required,integer,intRange"> > > name="range" > key="${var:min}" > resource="false"/> > name="range" > key="${var:max}" > resource="false"/> > > min > 10 > > > max > 20 > > > > > ---Original Message--- > From: Erez Efrati <[EMAIL PROTECTED]> > Sent: 08/06/03 02:41 PM > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > Subject: validating a html:select box > > > > > I have a selection box with options where the first is valued 0 (=not > selected) with some label saying: "month". How can I use the Struts > validator to validate the user has actually chosen a value other than 0? > Do I have to write one of my own? I wish the validwhen was around... > > By the way the 'birthMonth' is an int (not a string). > > Here is a snip of my page: > > > > > > > > > > > > > > > > Thanks a lot, > Erez > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] &
Re: RE: validating a html:select box
Erez, In that field validation, you can overload the sentence given back on that error. After add something like: Then just add an application resource line such as: month.too.short=Please select a valid month. Or month.too.short=Please select a valid {0} to show the field name you put as arg0 in your validations xml configuration file. Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:06 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: validating a html:select box > > I guess I'd have to change the msg key to something else than the default message telling the value is out of range. What happens with html:radio? Is this also the way also to validate radio options? If no radio is selected (and I know this is off topic, well a bit) would the browser send a value? Thanks, Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 4:59 PM To: Struts Users Mailing List Subject: Re: validating a html:select box Erez, The Struts Validator has an intRange function. It's in the Validator User Guide: http://jakarta.apache.org/struts/userGuide/dev_validator.html Here's an example from that page so you can set your min & max as 1 & 12 to prevent the zero (label "month"?) from being submitted: min 10 max 20 ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 02:41 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: validating a html:select box > > I have a selection box with options where the first is valued 0 (=not selected) with some label saying: "month". How can I use the Struts validator to validate the user has actually chosen a value other than 0? Do I have to write one of my own? I wish the validwhen was around... By the way the 'birthMonth' is an int (not a string). Here is a snip of my page: Thanks a lot, Erez - 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: RE: RE: validating a html:select box
Erez, Good point, a number of validator-rules.xml entries seem skewed toward text or textarea, not necessarily the other types. I've updated my validator-rules.xml and got it to work for a single choice "select" with one problem: The error message is pulling null in for the min and max so it's reading like: Month must be in the range null through null. For now, I've overloaded that using a message resource that only asks for {0} (the field name) not the min/max. If you want my validator-rules.xml that does this single-choice (not multiple) selects for intRange, email me off-list. Note: Tiles maintainers, can you drop me a line so I can submit this after I test it on a few more browsers (not just my IE but Opera and Netscape) for possible inclusion in the next nightly build - Does tiles do nightly builds? Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:38 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: RE: validating a html:select box > > For some reason, the javascript for intRange is not working if the property is a selection . I looked in the javascript code (I am new to that still) but I saw that it only checks for the range if the field is a text or textarea. Is this true? How can I perform the client validation for selection boxes? Change the javascript? Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 5:22 PM To: Struts Users Mailing List Subject: Re: RE: validating a html:select box Erez, In that field validation, you can overload the sentence given back on that error. After add something like: Then just add an application resource line such as: month.too.short=Please select a valid month. Or month.too.short=Please select a valid {0} to show the field name you put as arg0 in your validations xml configuration file. Regards, David ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 03:06 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: RE: validating a html:select box > > I guess I'd have to change the msg key to something else than the default message telling the value is out of range. What happens with html:radio? Is this also the way also to validate radio options? If no radio is selected (and I know this is off topic, well a bit) would the browser send a value? Thanks, Erez -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 4:59 PM To: Struts Users Mailing List Subject: Re: validating a html:select box Erez, The Struts Validator has an intRange function. It's in the Validator User Guide: http://jakarta.apache.org/struts/userGuide/dev_validator.html Here's an example from that page so you can set your min & max as 1 & 12 to prevent the zero (label "month"?) from being submitted: ---Original Message--- From: Erez Efrati <[EMAIL PROTECTED]> Sent: 08/06/03 02:41 PM To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: validating a html:select box > > I have a selection box with options where the first is valued 0 (=not selected) with some label saying: "month". How can I use the Struts validator to validate the user has actually chosen a value other than 0? Do I have to write one of my own? I wish the validwhen was around... By the way the 'birthMonth' is an int (not a string). Here is a snip of my page: Thanks a lot, Erez - 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 additiona