Checkbox readonly


#1

I declare some checkboxes :

<%= check_box_tag ‘offers[]’, offer.id ,
@params[:offers].include?(offer.id.to_s) ,:readonly=>true %>

the result is :

But readonly doesn’t work ???


#2

disabled doesn’t get posted in the browser, readonly does.
so i need readonly, i want the values but they cannot edit them :slight_smile:

Ali Hamidi wrote:

daniel wijnands wrote:

I declare some checkboxes :

<%= check_box_tag ‘offers[]’, offer.id ,
@params[:offers].include?(offer.id.to_s) ,:readonly=>true %>

the result is :

But readonly doesn’t work ???

Hi,

this site might be of some use to you:
http://www.htmlcodetutorial.com/forms/_INPUT_DISABLED.html

In a nutshell it explains that READONLY only prevents users from
changing the VALUE. i.e. the user can still interact with the checkbox.
Perhaps DISABLED is what you’re looking for.

Ali


#3

With what i understand a readonly property works with textbox & textarea
and all but not with a checkbox, if u want to make the checkbox non
editable by the user u have to make the disabled property true, to still
get the value either have a hidden input or make the disabled property
false onsubmit


#4

daniel wijnands wrote:

I declare some checkboxes :

<%= check_box_tag ‘offers[]’, offer.id ,
@params[:offers].include?(offer.id.to_s) ,:readonly=>true %>

the result is :

But readonly doesn’t work ???

Hi,

this site might be of some use to you:
http://www.htmlcodetutorial.com/forms/_INPUT_DISABLED.html

In a nutshell it explains that READONLY only prevents users from
changing the VALUE. i.e. the user can still interact with the checkbox.
Perhaps DISABLED is what you’re looking for.

Ali