Forum: Ruby on Rails Checkbox readonly

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel W. (Guest)
on 2005-12-21 12:38
I declare some checkboxes :

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

the result is :

<input checked="checked" id="offers[]" name="offers[]"
readonly="readonly" type="checkbox" value="1" />

But readonly doesn't work ???
Ali Hamidi (Guest)
on 2005-12-21 12:52
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 :
>
> <input checked="checked" id="offers[]" name="offers[]"
> readonly="readonly" type="checkbox" value="1" />
>
> 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
Daniel W. (Guest)
on 2005-12-21 13:34
disabled doesn't get posted in the browser, readonly does.
so i need readonly, i want the values but they cannot edit them :)



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 :
>>
>> <input checked="checked" id="offers[]" name="offers[]"
>> readonly="readonly" type="checkbox" value="1" />
>>
>> 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
Raghuraman Suraj (Guest)
on 2005-12-21 14:00
(Received via mailing list)
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
This topic is locked and can not be replied to.