On Aug 20, 12:18 pm, Hemant Bhargava <rails-mailing-l...@andreas-
s.net> wrote:
> Hello,
>
> Is dere any way to give default value or value to select tags ..
> My scenario is:-
>
> <% value_array = [1, 2, 3, 4, 5] %>
> <select name="abc[def]">
>   <%= options_for_select (value_array) %>
> </select>
>
Read the docs for options_for_select

Fred
> Now i am storing these values in database.. But after storing value i do
> not know how to show those values in my DDL(Drop down list)..
> like i stored value 4 in database regarding to this DDL. And now i want
> this value 4 as the selected value in my DDL..
>
> Hope you all people got my point ..
>
> I am doing it like this:-
> <% value_array = [1, 2, 3, 4, 5] %>
> <select name="abc[def]" value="whatever value in database">
>   <%= options_for_select (value_array) %>
> </select>
>
> Want to know every possible solution .. :)
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to