You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Galbreath, Mark" <Ga...@tessco.com> on 2002/10/04 14:20:51 UTC

RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked

Hey man!  RU refactoring my messages?  ;-)

-----Original Message-----
From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
Sent: Friday, October 04, 2002 8:17 AM
To: Struts Users Mailing List
Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted
When CheckBox is unchecked


For multiple, you also must set values back to false in reset() (The
question here of course is which checkbox refers to which element. You may
need to refactor such that your checkboxes return non boolean values so you
can tell which is which at the server end).
The reason for this is that the html spec in all its gory... uh I mean
glory... has in its infinite wisdom defined that a checkbox (& radio button
I think) that has not been ticked will not submit any value to the server.
Afaik same is true for SELECT btw (multiple selections where nothing
selected)

-----Original Message-----
From: Charlesworth, Chico [mailto:Chico.Charlesworth@softwareag.co.uk]
Sent: Friday, October 04, 2002 19:11
To: 'Struts Users Mailing List'
Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When
CheckBox is unchecked



Hi,

I'm trying to iterate through a Boolean Array using logic:iterate and then
display these as check boxes. This works fine, but when submitting the form
and resending the Boolean Array back to the Action class, only the values
that are true are returned.

In the struts documentation it says:
WARNING: In order to correctly recognize unchecked checkboxes, the
ActionForm bean associated with this form must include a statement setting
the corresponding boolean property to false in the reset() method.

But this only implies for a single property.

Is there a workaround or a fix for this?

My jsp code:

<logic:iterate id="flag" name="myForm" property="flags">
<logic:equal name=" flag " value="true">
	<input type="checkbox" id="flags" name="flags" value="on"
checked="checked">
</logic:equal>
<logic:notEqual name=" flag " value="true">
	<input type="checkbox" id="flags" name="flags" value="on">
</logic:notEqual>
</logic:iterate>

Cheers,
Chico.

--
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [OT] CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked

Posted by Andrew Hill <an...@gridnode.com>.
rofl

-----Original Message-----
From: Dave Derry [mailto:dderry@acm.org]
Sent: Friday, October 04, 2002 20:49
To: Struts Users Mailing List
Subject: [OT] CheckBox and Boolean[] Array - Incorrect Values Submitted
When CheckBox is unchecked


He's doing it as a service for those who are filtering you Mark!    ;-))


----- Original Message -----
From: "Galbreath, Mark" <Ga...@tessco.com>


> Hey man!  RU refactoring my messages?  ;-)
>
> -----Original Message-----
> From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
>
>
> For multiple, you also must set values back to false in reset() (The
> question here of course is which checkbox refers to which element. You may
> need to refactor such that your checkboxes return non boolean values so
you
> can tell which is which at the server end).
> The reason for this is that the html spec in all its gory... uh I mean
> glory... has in its infinite wisdom defined that a checkbox (& radio
button
> I think) that has not been ticked will not submit any value to the server.
> Afaik same is true for SELECT btw (multiple selections where nothing
> selected)
>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[OT] CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked

Posted by Dave Derry <dd...@acm.org>.
He's doing it as a service for those who are filtering you Mark!    ;-))


----- Original Message -----
From: "Galbreath, Mark" <Ga...@tessco.com>


> Hey man!  RU refactoring my messages?  ;-)
>
> -----Original Message-----
> From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
>
>
> For multiple, you also must set values back to false in reset() (The
> question here of course is which checkbox refers to which element. You may
> need to refactor such that your checkboxes return non boolean values so
you
> can tell which is which at the server end).
> The reason for this is that the html spec in all its gory... uh I mean
> glory... has in its infinite wisdom defined that a checkbox (& radio
button
> I think) that has not been ticked will not submit any value to the server.
> Afaik same is true for SELECT btw (multiple selections where nothing
> selected)
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked

Posted by Andrew Hill <an...@gridnode.com>.
Wrote it before I read yours.
Just had a beer and a G&T so my telepathic powers must have come online as a
result ;-)
Ahhh... I do so love Fridays.

-----Original Message-----
From: Galbreath, Mark [mailto:Galbreath@tessco.com]
Sent: Friday, October 04, 2002 20:21
To: 'Struts Users Mailing List'
Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted
When CheckBox is unchecked


Hey man!  RU refactoring my messages?  ;-)

-----Original Message-----
From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
Sent: Friday, October 04, 2002 8:17 AM
To: Struts Users Mailing List
Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted
When CheckBox is unchecked


For multiple, you also must set values back to false in reset() (The
question here of course is which checkbox refers to which element. You may
need to refactor such that your checkboxes return non boolean values so you
can tell which is which at the server end).
The reason for this is that the html spec in all its gory... uh I mean
glory... has in its infinite wisdom defined that a checkbox (& radio button
I think) that has not been ticked will not submit any value to the server.
Afaik same is true for SELECT btw (multiple selections where nothing
selected)

-----Original Message-----
From: Charlesworth, Chico [mailto:Chico.Charlesworth@softwareag.co.uk]
Sent: Friday, October 04, 2002 19:11
To: 'Struts Users Mailing List'
Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When
CheckBox is unchecked



Hi,

I'm trying to iterate through a Boolean Array using logic:iterate and then
display these as check boxes. This works fine, but when submitting the form
and resending the Boolean Array back to the Action class, only the values
that are true are returned.

In the struts documentation it says:
WARNING: In order to correctly recognize unchecked checkboxes, the
ActionForm bean associated with this form must include a statement setting
the corresponding boolean property to false in the reset() method.

But this only implies for a single property.

Is there a workaround or a fix for this?

My jsp code:

<logic:iterate id="flag" name="myForm" property="flags">
<logic:equal name=" flag " value="true">
	<input type="checkbox" id="flags" name="flags" value="on"
checked="checked">
</logic:equal>
<logic:notEqual name=" flag " value="true">
	<input type="checkbox" id="flags" name="flags" value="on">
</logic:notEqual>
</logic:iterate>

Cheers,
Chico.

--
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>