Sunday, November 1, 2009

[Rails] Re: How to disable a item of select box

Brijesh Shah wrote:
> Hi
>
> I want to disable only one item of select box.
>
> I tried to used :disabled=>'item' but it disable select box itself.
>
> So anybody how to do this?
>
> Thanks
> Brijesh Shah

Hi Brijesh,

I hope the following example would help you.. If not put your code
here..

Example:

select("post", "category", Post::CATEGORIES, {:disabled =>
'restricted'})

could become:

<select name="post[category]">
<option></option>
<option>joke</option>
<option>poem</option>
<option disabled="disabled">restricted</option>
</select>

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate