Re: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Robert Leland
Greg Amaroso wrote:

I currently have Struts 1.1. Is the checkbox/radio update available in the
most current nightly build?
 

Yes. Even though it contains a commons-validator dated from August 16 th.

Also, should the form-property type be "boolean" or "java.lang.Boolean"
(case-sensitive of course)?
Thanks.


 

From: "Mathew, Manoj" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Date: Thu, 4 Sep 2003 08:48:19 -0500
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: RE: Struts form validation of radio buttons and checkboxes
YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION WE
WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT
"FALSE"
ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
getCheckbox():return String  in your action form.
-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 7:48 AM
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes
Thanks for the response, but I don't think the problem lies with the actual
validation that's happening.
I suspect that when a user submits the form page without a checkbox/radio
button checked, a blank variable is never sent to the form bean (i.e
http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
The form bean then sees it as as a nonexistent variable and returns a trace
stack error. Any other ideas?
I will however update my struts package.


   

From: Robert Leland <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Date: Wed, 03 Sep 2003 22:09:14 -0400
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Struts form validation of radio buttons and checkboxes
Greg Amaroso wrote:

 

I'm having trouble with the struts form validation framework when it comes
to radio buttons and checkboxes. For some reason, I can validate any other
type of field, but not radios/checkboxes. Here's where I seem to be having
trouble: 

   

Try a --nightly-- build of struts. I believe it has enhancements in
commons-validator to validate
radio controls. you can tell for sure by looking at the validator-rules.xml.
In there you'll see itels like :
 function validateRequired(form) {
   
//Stuff deleted.
   
 if (field.type == 'text' ||
 //stuff deleted
 field.type == 'radio' ||
 field.type == 'password') {

So this says that for the 'required' rule radio is supported.

Do the same for integer, byte, etc to see if 'radio' is supported.

 

In the struts-config.xml file, should the form-property type be set to
java.lang.String or java.lang.Boolean?
In the page with the form, does it look right to create the radio buttons
like this:





Are there any other tricks to doing this that differs from validating
standard text boxes, textareas, etc.?
Thank in advance.

Greg Amaroso



   



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


Re: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Robert Leland
Mathew, Manoj wrote:

YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. 

Did you file a Bugzilla bug report ? If not could you file a Bugilla 
report, attaching a detailed description and/or
test case is the best way to get this fixed.

Thanks

IN OUR APPLICATION WE WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT "FALSE"

ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if getCheckbox():return String  in your action form.

-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 7:48 AM
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes
Thanks for the response, but I don't think the problem lies with the actual
validation that's happening.
I suspect that when a user submits the form page without a checkbox/radio
button checked, a blank variable is never sent to the form bean (i.e
http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
The form bean then sees it as as a nonexistent variable and returns a trace
stack error. Any other ideas?
I will however update my struts package.


 

From: Robert Leland <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Date: Wed, 03 Sep 2003 22:09:14 -0400
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Struts form validation of radio buttons and checkboxes
Greg Amaroso wrote:

   

I'm having trouble with the struts form validation framework when it comes
to radio buttons and checkboxes. For some reason, I can validate any other
type of field, but not radios/checkboxes. Here's where I seem to be having
trouble: 

 

Try a --nightly-- build of struts. I believe it has enhancements in
commons-validator to validate
radio controls. you can tell for sure by looking at the validator-rules.xml.
In there you'll see itels like :
 function validateRequired(form) {
   
//Stuff deleted.

 if (field.type == 'text' ||
 //stuff deleted
 field.type == 'radio' ||
 field.type == 'password') {

So this says that for the 'required' rule radio is supported.

Do the same for integer, byte, etc to see if 'radio' is supported.

   

In the struts-config.xml file, should the form-property type be set to
java.lang.String or java.lang.Boolean?
In the page with the form, does it look right to create the radio buttons
like this:





Are there any other tricks to doing this that differs from validating
standard text boxes, textareas, etc.?
Thank in advance.

Greg Amaroso

 



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


RE: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Mathew, Manoj
As Hill said it is not the issue with the struts but with the HTML. SO i don't think 
it has to do anything with the version of struts you are using.

type is boolean ( primitive)..  not Boolean.

thanks

-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 9:00 AM
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes


I currently have Struts 1.1. Is the checkbox/radio update available in the
most current nightly build?
Also, should the form-property type be "boolean" or "java.lang.Boolean"
(case-sensitive of course)?
Thanks.



> From: "Mathew, Manoj" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Thu, 4 Sep 2003 08:48:19 -0500
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Subject: RE: Struts form validation of radio buttons and checkboxes
> 
> YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
> HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION WE
> WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT
> "FALSE"
> 
> ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
> getCheckbox():return String  in your action form.
> 
> -Original Message-
> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 04, 2003 7:48 AM
> To: Struts Users Mailing List
> Subject: Re: Struts form validation of radio buttons and checkboxes
> 
> 
> Thanks for the response, but I don't think the problem lies with the actual
> validation that's happening.
> I suspect that when a user submits the form page without a checkbox/radio
> button checked, a blank variable is never sent to the form bean (i.e
> http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
> The form bean then sees it as as a nonexistent variable and returns a trace
> stack error. Any other ideas?
> I will however update my struts package.
> 
> 
> 
>> From: Robert Leland <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Date: Wed, 03 Sep 2003 22:09:14 -0400
>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>> Subject: Re: Struts form validation of radio buttons and checkboxes
>> 
>> Greg Amaroso wrote:
>> 
>>> I'm having trouble with the struts form validation framework when it comes
>>> to radio buttons and checkboxes. For some reason, I can validate any other
>>> type of field, but not radios/checkboxes. Here's where I seem to be having
>>> trouble: 
>>>  
>>> 
>> Try a --nightly-- build of struts. I believe it has enhancements in
>> commons-validator to validate
>> radio controls. you can tell for sure by looking at the validator-rules.xml.
>> 
>> In there you'll see itels like :
>>   function validateRequired(form) {
>> 
>> //Stuff deleted.
>> 
>>   if (field.type == 'text' ||
>>   //stuff deleted
>>   field.type == 'radio' ||
>>   field.type == 'password') {
>> 
>> So this says that for the 'required' rule radio is supported.
>> 
>> Do the same for integer, byte, etc to see if 'radio' is supported.
>> 
>>> In the struts-config.xml file, should the form-property type be set to
>>> java.lang.String or java.lang.Boolean?
>>> 
>>> In the page with the form, does it look right to create the radio buttons
>>> like this:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Are there any other tricks to doing this that differs from validating
>>> standard text boxes, textareas, etc.?
>>> 
>>> Thank in advance.
>>> 
>>> 
>>> Greg Amaroso
>>> 
>>>  
>>> 
>> 
>> 
>> 
>> -
>> 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: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Andrew Hill

don't understand why I want to reset the checkboxes to their unticked value.


Im in a hurry to get home (taxi fare doubles after midnight!) so dont have
time to explain in detail, but if you check the javadocs for the reset()
method and search the mail list archive you should be able to find the info
you need :-) (This question is a regular one!)

Mind you, if your form is request scoped it would implicitly be 'reset' as
you are getting a new form instance each time. Hmm. Have you perchance set
the default value for the checkbox to be ticked or is this a session scoped
form?

-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, 4 September 2003 23:03
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes


No, I haven't implemented it yet. But I must plead ignorance here, because I
don't understand why I want to reset the checkboxes to their unticked value.
If I'm submitting the form essentially back to itself, what does the
unticked value do for me? Or am I missing something?

As for the radio buttons, making the first one already selected is my out
with that. I only included them in this discussion because they
fundamentally work in the same way as checkboxes (i.e. they don't send
variables if not checked).

Thanks.

Greg



> From: "Andrew Hill" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Thu, 4 Sep 2003 22:38:19 +0800
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Subject: RE: Struts form validation of radio buttons and checkboxes
>
> Have you implemented code in reset() to reset the checkbox to its unticked
> value in the form yet?
>
> Not sure why radio buttons would give you problems though.
> They usually have one option selected which would get submitted.
>
>
> -Original Message-
> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 4 September 2003 22:00
> To: Struts Users Mailing List
> Subject: Re: Struts form validation of radio buttons and checkboxes
>
>
> I currently have Struts 1.1. Is the checkbox/radio update available in the
> most current nightly build?
> Also, should the form-property type be "boolean" or "java.lang.Boolean"
> (case-sensitive of course)?
> Thanks.
>
>
>
>> From: "Mathew, Manoj" <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Date: Thu, 4 Sep 2003 08:48:19 -0500
>> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Subject: RE: Struts form validation of radio buttons and checkboxes
>>
>> YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT
EVEN
>> HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION
> WE
>> WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE
> IT
>> "FALSE"
>>
>> ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
>> getCheckbox():return String  in your action form.
>>
>> -Original Message-
>> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, September 04, 2003 7:48 AM
>> To: Struts Users Mailing List
>> Subject: Re: Struts form validation of radio buttons and checkboxes
>>
>>
>> Thanks for the response, but I don't think the problem lies with the
> actual
>> validation that's happening.
>> I suspect that when a user submits the form page without a checkbox/radio
>> button checked, a blank variable is never sent to the form bean (i.e
>> http://www.url.com/servlet.do?checkboxvar=), it just doesn't send
> anything.
>> The form bean then sees it as as a nonexistent variable and returns a
> trace
>> stack error. Any other ideas?
>> I will however update my struts package.
>>
>>
>>
>>> From: Robert Leland <[EMAIL PROTECTED]>
>>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>> Date: Wed, 03 Sep 2003 22:09:14 -0400
>>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>> Subject: Re: Struts form validation of radio buttons and checkboxes
>>>
>>> Greg Amaroso wrote:
>>>
>>>> I'm having trouble with the struts form validation framework when it
> comes
>>>> to radio buttons and checkboxes. For some reason, I can validate any
> other
>>>> type of field, but not radios/checkboxes. Here's where I seem to be
> having
>>>> trouble:
>>>>
>>>>
>>> Try a --nightly-- build of struts. I believe it has enhanceme

Re: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Greg Amaroso
No, I haven't implemented it yet. But I must plead ignorance here, because I
don't understand why I want to reset the checkboxes to their unticked value.
If I'm submitting the form essentially back to itself, what does the
unticked value do for me? Or am I missing something?

As for the radio buttons, making the first one already selected is my out
with that. I only included them in this discussion because they
fundamentally work in the same way as checkboxes (i.e. they don't send
variables if not checked).

Thanks.

Greg



> From: "Andrew Hill" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Thu, 4 Sep 2003 22:38:19 +0800
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Subject: RE: Struts form validation of radio buttons and checkboxes
> 
> Have you implemented code in reset() to reset the checkbox to its unticked
> value in the form yet?
> 
> Not sure why radio buttons would give you problems though.
> They usually have one option selected which would get submitted.
> 
> 
> -Original Message-
> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 4 September 2003 22:00
> To: Struts Users Mailing List
> Subject: Re: Struts form validation of radio buttons and checkboxes
> 
> 
> I currently have Struts 1.1. Is the checkbox/radio update available in the
> most current nightly build?
> Also, should the form-property type be "boolean" or "java.lang.Boolean"
> (case-sensitive of course)?
> Thanks.
> 
> 
> 
>> From: "Mathew, Manoj" <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Date: Thu, 4 Sep 2003 08:48:19 -0500
>> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Subject: RE: Struts form validation of radio buttons and checkboxes
>> 
>> YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
>> HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION
> WE
>> WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE
> IT
>> "FALSE"
>> 
>> ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
>> getCheckbox():return String  in your action form.
>> 
>> -Original Message-
>> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, September 04, 2003 7:48 AM
>> To: Struts Users Mailing List
>> Subject: Re: Struts form validation of radio buttons and checkboxes
>> 
>> 
>> Thanks for the response, but I don't think the problem lies with the
> actual
>> validation that's happening.
>> I suspect that when a user submits the form page without a checkbox/radio
>> button checked, a blank variable is never sent to the form bean (i.e
>> http://www.url.com/servlet.do?checkboxvar=), it just doesn't send
> anything.
>> The form bean then sees it as as a nonexistent variable and returns a
> trace
>> stack error. Any other ideas?
>> I will however update my struts package.
>> 
>> 
>> 
>>> From: Robert Leland <[EMAIL PROTECTED]>
>>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>> Date: Wed, 03 Sep 2003 22:09:14 -0400
>>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>> Subject: Re: Struts form validation of radio buttons and checkboxes
>>> 
>>> Greg Amaroso wrote:
>>> 
>>>> I'm having trouble with the struts form validation framework when it
> comes
>>>> to radio buttons and checkboxes. For some reason, I can validate any
> other
>>>> type of field, but not radios/checkboxes. Here's where I seem to be
> having
>>>> trouble:
>>>> 
>>>> 
>>> Try a --nightly-- build of struts. I believe it has enhancements in
>>> commons-validator to validate
>>> radio controls. you can tell for sure by looking at the
> validator-rules.xml.
>>> 
>>> In there you'll see itels like :
>>>   function validateRequired(form) {
>>> 
>>> //Stuff deleted.
>>> 
>>>   if (field.type == 'text' ||
>>>   //stuff deleted
>>>   field.type == 'radio' ||
>>>   field.type == 'password') {
>>> 
>>> So this says that for the 'required' rule radio is supported.
>>> 
>>> Do the same for integer, byte, etc to see if '

RE: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Andrew Hill
Have you implemented code in reset() to reset the checkbox to its unticked
value in the form yet?

Not sure why radio buttons would give you problems though.
They usually have one option selected which would get submitted.


-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, 4 September 2003 22:00
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes


I currently have Struts 1.1. Is the checkbox/radio update available in the
most current nightly build?
Also, should the form-property type be "boolean" or "java.lang.Boolean"
(case-sensitive of course)?
Thanks.



> From: "Mathew, Manoj" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Thu, 4 Sep 2003 08:48:19 -0500
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Subject: RE: Struts form validation of radio buttons and checkboxes
>
> YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
> HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION
WE
> WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE
IT
> "FALSE"
>
> ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
> getCheckbox():return String  in your action form.
>
> -Original Message-
> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 04, 2003 7:48 AM
> To: Struts Users Mailing List
> Subject: Re: Struts form validation of radio buttons and checkboxes
>
>
> Thanks for the response, but I don't think the problem lies with the
actual
> validation that's happening.
> I suspect that when a user submits the form page without a checkbox/radio
> button checked, a blank variable is never sent to the form bean (i.e
> http://www.url.com/servlet.do?checkboxvar=), it just doesn't send
anything.
> The form bean then sees it as as a nonexistent variable and returns a
trace
> stack error. Any other ideas?
> I will however update my struts package.
>
>
>
>> From: Robert Leland <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Date: Wed, 03 Sep 2003 22:09:14 -0400
>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>> Subject: Re: Struts form validation of radio buttons and checkboxes
>>
>> Greg Amaroso wrote:
>>
>>> I'm having trouble with the struts form validation framework when it
comes
>>> to radio buttons and checkboxes. For some reason, I can validate any
other
>>> type of field, but not radios/checkboxes. Here's where I seem to be
having
>>> trouble:
>>>
>>>
>> Try a --nightly-- build of struts. I believe it has enhancements in
>> commons-validator to validate
>> radio controls. you can tell for sure by looking at the
validator-rules.xml.
>>
>> In there you'll see itels like :
>>   function validateRequired(form) {
>>
>> //Stuff deleted.
>>
>>   if (field.type == 'text' ||
>>   //stuff deleted
>>   field.type == 'radio' ||
>>   field.type == 'password') {
>>
>> So this says that for the 'required' rule radio is supported.
>>
>> Do the same for integer, byte, etc to see if 'radio' is supported.
>>
>>> In the struts-config.xml file, should the form-property type be set to
>>> java.lang.String or java.lang.Boolean?
>>>
>>> In the page with the form, does it look right to create the radio
buttons
>>> like this:
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> Are there any other tricks to doing this that differs from validating
>>> standard text boxes, textareas, etc.?
>>>
>>> Thank in advance.
>>>
>>>
>>> Greg Amaroso
>>>
>>>
>>>
>>
>>
>>
>> -
>> 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: Struts form validation of radio buttons and checkboxes

2003-09-04 Thread Greg Amaroso
I currently have Struts 1.1. Is the checkbox/radio update available in the
most current nightly build?
Also, should the form-property type be "boolean" or "java.lang.Boolean"
(case-sensitive of course)?
Thanks.



> From: "Mathew, Manoj" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Thu, 4 Sep 2003 08:48:19 -0500
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Subject: RE: Struts form validation of radio buttons and checkboxes
> 
> YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
> HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION WE
> WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT
> "FALSE"
> 
> ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
> getCheckbox():return String  in your action form.
> 
> -Original Message-
> From: Greg Amaroso [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 04, 2003 7:48 AM
> To: Struts Users Mailing List
> Subject: Re: Struts form validation of radio buttons and checkboxes
> 
> 
> Thanks for the response, but I don't think the problem lies with the actual
> validation that's happening.
> I suspect that when a user submits the form page without a checkbox/radio
> button checked, a blank variable is never sent to the form bean (i.e
> http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
> The form bean then sees it as as a nonexistent variable and returns a trace
> stack error. Any other ideas?
> I will however update my struts package.
> 
> 
> 
>> From: Robert Leland <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>> Date: Wed, 03 Sep 2003 22:09:14 -0400
>> To: Struts Users Mailing List <[EMAIL PROTECTED]>
>> Subject: Re: Struts form validation of radio buttons and checkboxes
>> 
>> Greg Amaroso wrote:
>> 
>>> I'm having trouble with the struts form validation framework when it comes
>>> to radio buttons and checkboxes. For some reason, I can validate any other
>>> type of field, but not radios/checkboxes. Here's where I seem to be having
>>> trouble: 
>>>  
>>> 
>> Try a --nightly-- build of struts. I believe it has enhancements in
>> commons-validator to validate
>> radio controls. you can tell for sure by looking at the validator-rules.xml.
>> 
>> In there you'll see itels like :
>>   function validateRequired(form) {
>> 
>> //Stuff deleted.
>> 
>>   if (field.type == 'text' ||
>>   //stuff deleted
>>   field.type == 'radio' ||
>>   field.type == 'password') {
>> 
>> So this says that for the 'required' rule radio is supported.
>> 
>> Do the same for integer, byte, etc to see if 'radio' is supported.
>> 
>>> In the struts-config.xml file, should the form-property type be set to
>>> java.lang.String or java.lang.Boolean?
>>> 
>>> In the page with the form, does it look right to create the radio buttons
>>> like this:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Are there any other tricks to doing this that differs from validating
>>> standard text boxes, textareas, etc.?
>>> 
>>> Thank in advance.
>>> 
>>> 
>>> Greg Amaroso
>>> 
>>>  
>>> 
>> 
>> 
>> 
>> -
>> 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 form validation of radio buttons and checkboxes

2003-09-04 Thread Andrew Hill
OI!
STOP ALL THAT SHOUTING!
ITS GIVING ME A HEADACHE.
(I know your terminal can do lower case - I can see it in your sample code!)

And while Ive got your attention, it is *not* "AN ERROR IN STRUTS" that the
checkbox is not submitted, it is a result of the html specifications (whose
writers probably came up with the idea after a few too many beers and
thought it would be a "bit of a laugh").

Browsers simply dont submit *anything* for an unticked checkbox and there
isnt anything that struts can do about it apart from provide a workaround in
the form of the reset() method. (Well actually I can think of one other
thing it could do but it involves JS and hidden fields and I rather doubt
the committers would approve.)

If you had bothered to read the javadoc for the reset() method of the
ActionForm class you would know this:

http://jakarta.apache.org/struts/api/index.html ">
Reset all bean properties to their default state. This method is called
before the properties are repopulated by the controller servlet. The default
implementation does nothing. Subclasses should override this method to reset
all bean properties to default values. This method is not the appropriate
place to initialize form values for an "update" type page (this should be
done in a setup Action). You mainly need to worry about setting checkbox
values to false; most of the time you can leave this method unimplemented


(Note the bit about checkboxes)


-Original Message-
From: Mathew, Manoj [mailto:[EMAIL PROTECTED]
Sent: Thursday, 4 September 2003 21:48
To: Struts Users Mailing List
Subject: RE: Struts form validation of radio buttons and checkboxes


YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN
HAVE THAT ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION WE
WROTE A CODE WHICH CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT
"FALSE"

ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if
getCheckbox():return String  in your action form.

-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 7:48 AM
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes


Thanks for the response, but I don't think the problem lies with the actual
validation that's happening.
I suspect that when a user submits the form page without a checkbox/radio
button checked, a blank variable is never sent to the form bean (i.e
http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
The form bean then sees it as as a nonexistent variable and returns a trace
stack error. Any other ideas?
I will however update my struts package.



> From: Robert Leland <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Wed, 03 Sep 2003 22:09:14 -0400
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Struts form validation of radio buttons and checkboxes
>
> Greg Amaroso wrote:
>
>> I'm having trouble with the struts form validation framework when it
comes
>> to radio buttons and checkboxes. For some reason, I can validate any
other
>> type of field, but not radios/checkboxes. Here's where I seem to be
having
>> trouble:
>>
>>
> Try a --nightly-- build of struts. I believe it has enhancements in
> commons-validator to validate
> radio controls. you can tell for sure by looking at the
validator-rules.xml.
>
> In there you'll see itels like :
>   function validateRequired(form) {
>
> //Stuff deleted.
>
>   if (field.type == 'text' ||
>   //stuff deleted
>   field.type == 'radio' ||
>   field.type == 'password') {
>
> So this says that for the 'required' rule radio is supported.
>
> Do the same for integer, byte, etc to see if 'radio' is supported.
>
>> In the struts-config.xml file, should the form-property type be set to
>> java.lang.String or java.lang.Boolean?
>>
>> In the page with the form, does it look right to create the radio buttons
>> like this:
>> 
>> 
>> 
>> 
>> 
>>
>> Are there any other tricks to doing this that differs from validating
>> standard text boxes, textareas, etc.?
>>
>> Thank in advance.
>>
>>
>> Greg Amaroso
>>
>>
>>
>
>
>
> -
> 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 form validation of radio buttons and checkboxes

2003-09-04 Thread Mathew, Manoj
YES YOU R RIGHT. WHEN THE CHECK BOX IS NOT CHECKED, THE FORM WILL NOT EVEN HAVE THAT 
ELEMENT PRESENT. THIS IS AN ERROR IN STRUTS. IN OUR APPLICATION WE WROTE A CODE WHICH 
CHECK FOR THIS ELEMENT AN IT IS IS NOT THERE THEN MADE IT "FALSE"

ALSO MAKE SURE YOU HAVE isCheckbox():return boolean  instead if getCheckbox():return 
String  in your action form.

-Original Message-
From: Greg Amaroso [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 7:48 AM
To: Struts Users Mailing List
Subject: Re: Struts form validation of radio buttons and checkboxes


Thanks for the response, but I don't think the problem lies with the actual
validation that's happening.
I suspect that when a user submits the form page without a checkbox/radio
button checked, a blank variable is never sent to the form bean (i.e
http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
The form bean then sees it as as a nonexistent variable and returns a trace
stack error. Any other ideas?
I will however update my struts package.



> From: Robert Leland <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Wed, 03 Sep 2003 22:09:14 -0400
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Struts form validation of radio buttons and checkboxes
> 
> Greg Amaroso wrote:
> 
>> I'm having trouble with the struts form validation framework when it comes
>> to radio buttons and checkboxes. For some reason, I can validate any other
>> type of field, but not radios/checkboxes. Here's where I seem to be having
>> trouble: 
>>  
>> 
> Try a --nightly-- build of struts. I believe it has enhancements in
> commons-validator to validate
> radio controls. you can tell for sure by looking at the validator-rules.xml.
> 
> In there you'll see itels like :
>   function validateRequired(form) {
> 
> //Stuff deleted.
>  
>   if (field.type == 'text' ||
>   //stuff deleted
>   field.type == 'radio' ||
>   field.type == 'password') {
> 
> So this says that for the 'required' rule radio is supported.
> 
> Do the same for integer, byte, etc to see if 'radio' is supported.
> 
>> In the struts-config.xml file, should the form-property type be set to
>> java.lang.String or java.lang.Boolean?
>> 
>> In the page with the form, does it look right to create the radio buttons
>> like this:
>> 
>> 
>> 
>> 
>> 
>> 
>> Are there any other tricks to doing this that differs from validating
>> standard text boxes, textareas, etc.?
>> 
>> Thank in advance.
>> 
>> 
>> Greg Amaroso
>> 
>>  
>> 
> 
> 
> 
> -
> 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 form validation of radio buttons and checkboxes

2003-09-04 Thread Greg Amaroso
Thanks for the response, but I don't think the problem lies with the actual
validation that's happening.
I suspect that when a user submits the form page without a checkbox/radio
button checked, a blank variable is never sent to the form bean (i.e
http://www.url.com/servlet.do?checkboxvar=), it just doesn't send anything.
The form bean then sees it as as a nonexistent variable and returns a trace
stack error. Any other ideas?
I will however update my struts package.



> From: Robert Leland <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Wed, 03 Sep 2003 22:09:14 -0400
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Struts form validation of radio buttons and checkboxes
> 
> Greg Amaroso wrote:
> 
>> I'm having trouble with the struts form validation framework when it comes
>> to radio buttons and checkboxes. For some reason, I can validate any other
>> type of field, but not radios/checkboxes. Here's where I seem to be having
>> trouble: 
>>  
>> 
> Try a --nightly-- build of struts. I believe it has enhancements in
> commons-validator to validate
> radio controls. you can tell for sure by looking at the validator-rules.xml.
> 
> In there you'll see itels like :
>   function validateRequired(form) {
> 
> //Stuff deleted.
>  
>   if (field.type == 'text' ||
>   //stuff deleted
>   field.type == 'radio' ||
>   field.type == 'password') {
> 
> So this says that for the 'required' rule radio is supported.
> 
> Do the same for integer, byte, etc to see if 'radio' is supported.
> 
>> In the struts-config.xml file, should the form-property type be set to
>> java.lang.String or java.lang.Boolean?
>> 
>> In the page with the form, does it look right to create the radio buttons
>> like this:
>> 
>> 
>> 
>> 
>> 
>> 
>> Are there any other tricks to doing this that differs from validating
>> standard text boxes, textareas, etc.?
>> 
>> Thank in advance.
>> 
>> 
>> Greg Amaroso
>> 
>>  
>> 
> 
> 
> 
> -
> 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 form validation of radio buttons and checkboxes

2003-09-03 Thread Robert Leland
Greg Amaroso wrote:

I'm having trouble with the struts form validation framework when it comes
to radio buttons and checkboxes. For some reason, I can validate any other
type of field, but not radios/checkboxes. Here's where I seem to be having
trouble: 
 

Try a --nightly-- build of struts. I believe it has enhancements in 
commons-validator to validate
radio controls. you can tell for sure by looking at the validator-rules.xml.

In there you'll see itels like :
   function validateRequired(form) {
 
//Stuff deleted.
  
   if (field.type == 'text' ||
   //stuff deleted
   field.type == 'radio' ||
   field.type == 'password') {

So this says that for the 'required' rule radio is supported.

Do the same for integer, byte, etc to see if 'radio' is supported.

In the struts-config.xml file, should the form-property type be set to
java.lang.String or java.lang.Boolean?
In the page with the form, does it look right to create the radio buttons
like this:





Are there any other tricks to doing this that differs from validating
standard text boxes, textareas, etc.?
Thank in advance. 

Greg Amaroso

 



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