Select tags

Hello,

Is dere any way to give default value or value to select tags …
My scenario is:-

<% value_array = [1, 2, 3, 4, 5] %>

<%= options_for_select (value_array) %>

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] %>

<%= options_for_select (value_array) %>

Want to know every possible solution … :slight_smile:

On Aug 20, 12:18 pm, Hemant B. <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] %>

<%= options_for_select (value_array) %>

Read the docs for options_for_select

Fred

Thanks for reply …
already read …

Is dere any type of mishappening is happening … I mean if i am storing
values in array as string …

Is dere any way to give default value or value to select tags …
My scenario is:-

<% value_array = [1, 2, 3, 4, 5] %>

� <%= options_for_select (value_array) %>

Read the docs for options_for_select

Fred

On Aug 20, 1:04 pm, Hemant B. [email protected]
wrote:

Thanks for reply …
already read …

And you didn’t notice that the second parameter to options_for_select
is the value to be selected ? (you do need to ensure that the type of
the selected value is the same as the type of the select options - a
common mistake is for one to be an integer and the other a string)

Fred