You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by akash agrawal <ak...@yahoo.co.uk> on 2008/07/09 19:56:49 UTC

problem with checkbox (when using disabled property)

Hi,

Using struts tag for a checkbox. I disable my checkbox using disabled property so that user cannot change it. When the form is submitted, the value of the checkbox passed to the action comes out as false, even if the checkbox was selected (true).

The weird thing is if I remove the disabled property it works as expected.

My code:
<s:checkbox name="myFlag" label="myLabel"                             value="%{model.isMyFlag()}" required="true" labelposition="left"                            disabled="true" tooltip="myToolTip" />

This checkbox is selected (true), when the form is submitted the value passed to the action is not selected (false).

Thanks.



      

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


Re: problem with checkbox (when using disabled property)

Posted by ravi_eze <ra...@ivycomptech.com>.
yes it doesnt. Atleast in version 2.0.9. i heard its fixed in 2.1 version.
you can write a reset interceptor also for this. i.e. always (before param
interceptor) reset the checkbox field. If there is some checkbox getting
submitted then you will get them, else the field would be reset by the
interceptor.

hth
ravi



Owen Berry wrote:
> 
> I would have thought <s:checkbox.../> would handle all of that for
> you, but I guess it may not be working, or doesn't aim to.
> 
> 2008/7/10 Paweł Wielgus <po...@gmail.com>:
>> Hi all,
>> just yesterday i had the very same problem in rails with date field,
>> so i searched for disabled definition and found this:
>> http://www.w3.org/TR/html401/interact/forms.html#successful-controls
>> and
>> http://www.w3.org/TR/html401/interact/forms.html#h-17.12
>> It looks like disabled flag will simply prevent the field from submiting.
>>
>> So an extra hidden field read-only should do the job.
>>
>> Best greetings,
>> Paweł Wielgus.
>>
>> On 10/07/2008, Dave Newton <ne...@yahoo.com> wrote:
>>> --- On Wed, 7/9/08, Owen Berry <ow...@gmail.com> wrote:
>>>  > You need to have a hidden field value that will take the
>>>  > place of the disabled checkbox as some browsers do not
>>>  > send disabled field values.
>>>
>>>
>>> The <s:checkbox.../> tag already includes the hidden field; I don't know
>>> what it does for disabled checkboxes, though. The checkbox interceptor
>>> *should* work in concert with the tag to handle disabled checkboxes as
>>> well, or at least I thought it did.
>>>
>>>
>>>  Dave
>>>
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>  For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-with-checkbox-%28when-using-disabled-property%29-tp18367328p18438098.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: problem with checkbox (when using disabled property)

Posted by Owen Berry <ow...@gmail.com>.
I would have thought <s:checkbox.../> would handle all of that for
you, but I guess it may not be working, or doesn't aim to.

2008/7/10 Paweł Wielgus <po...@gmail.com>:
> Hi all,
> just yesterday i had the very same problem in rails with date field,
> so i searched for disabled definition and found this:
> http://www.w3.org/TR/html401/interact/forms.html#successful-controls
> and
> http://www.w3.org/TR/html401/interact/forms.html#h-17.12
> It looks like disabled flag will simply prevent the field from submiting.
>
> So an extra hidden field read-only should do the job.
>
> Best greetings,
> Paweł Wielgus.
>
> On 10/07/2008, Dave Newton <ne...@yahoo.com> wrote:
>> --- On Wed, 7/9/08, Owen Berry <ow...@gmail.com> wrote:
>>  > You need to have a hidden field value that will take the
>>  > place of the disabled checkbox as some browsers do not
>>  > send disabled field values.
>>
>>
>> The <s:checkbox.../> tag already includes the hidden field; I don't know what it does for disabled checkboxes, though. The checkbox interceptor *should* work in concert with the tag to handle disabled checkboxes as well, or at least I thought it did.
>>
>>
>>  Dave
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: problem with checkbox (when using disabled property)

Posted by Paweł Wielgus <po...@gmail.com>.
Hi all,
just yesterday i had the very same problem in rails with date field,
so i searched for disabled definition and found this:
http://www.w3.org/TR/html401/interact/forms.html#successful-controls
and
http://www.w3.org/TR/html401/interact/forms.html#h-17.12
It looks like disabled flag will simply prevent the field from submiting.

So an extra hidden field read-only should do the job.

Best greetings,
Paweł Wielgus.

On 10/07/2008, Dave Newton <ne...@yahoo.com> wrote:
> --- On Wed, 7/9/08, Owen Berry <ow...@gmail.com> wrote:
>  > You need to have a hidden field value that will take the
>  > place of the disabled checkbox as some browsers do not
>  > send disabled field values.
>
>
> The <s:checkbox.../> tag already includes the hidden field; I don't know what it does for disabled checkboxes, though. The checkbox interceptor *should* work in concert with the tag to handle disabled checkboxes as well, or at least I thought it did.
>
>
>  Dave
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: problem with checkbox (when using disabled property)

Posted by Dave Newton <ne...@yahoo.com>.
--- On Wed, 7/9/08, Owen Berry <ow...@gmail.com> wrote:
> You need to have a hidden field value that will take the
> place of the disabled checkbox as some browsers do not 
> send disabled field values.

The <s:checkbox.../> tag already includes the hidden field; I don't know what it does for disabled checkboxes, though. The checkbox interceptor *should* work in concert with the tag to handle disabled checkboxes as well, or at least I thought it did.

Dave


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


Re: problem with checkbox (when using disabled property)

Posted by Owen Berry <ow...@gmail.com>.
You need to have a hidden field value that will take the place of the
disabled checkbox as some browsers do not send disabled field values.
Basically, it's just for display.

On Wed, Jul 9, 2008 at 2:29 PM, Lukasz Lenart
<lu...@googlemail.com> wrote:
> Did you try with some others browsers, like IE, FF?
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> 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: problem with checkbox (when using disabled property)

Posted by Lukasz Lenart <lu...@googlemail.com>.
Did you try with some others browsers, like IE, FF?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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