Checkbox readonly

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 ???

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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs