Just i used the select_tag in the rails3 for the country selection option. But when i click on that ,i didn''t give any option. here is the code which am used. <%= select_tag( "<option value=1>c1</option><option value=2>ctnry</option><option value=3>cntry</option><option value=4>cntry</option>" , :class => "span2" ) %> Is there any problem with this ...? Thank you vishnu -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/pCddUe32OkYJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 27 February 2012 16:01, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just i used the select_tag in the rails3 for the country selection option. > But when i click on that ,i didn''t give any option. here is the code which > am used. > > <%= select_tag( "<option > value=1>c1</option><option value=2>ctnry</option><option value=3>cntry</option><option value=4>cntry</option>" > , :class => "span2" ) %>Yes, you have got it all wrong I am afraid. Have a look at the html it is generating and you will see the problem. Have a look at the docs for select_tag to see where you are going wrong. Whenever something is not working it is worth looking at the html. Are you sure you should not be using f.select rather than select_tag? You should use form_for whenever appropriate rather than form_tag. Colin Colin> > Is there any problem with this ...? > > > > Thank you > vishnu > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/pCddUe32OkYJ. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en.-- gplus.to/clanlaw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On 27 February 2012 16:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > >> >> > Just i used the select_tag in the rails3 for the country selection >> > option. >> > But when i click on that ,i didn''t give any option. here is the code >> > which >> > am used. >> > >> > <%= select_tag( "<option >> > >> > value=1>c1</option><option value=2>ctnry</option><option value=3>cntry</option><option value=4>cntry</option>" >> > , :class => "span2" ) %> >> >> Yes, you have got it all wrong I am afraid. Have a look at the html >> it is generating and you will see the problem. Have a look at the >> docs for select_tag to see where you are going wrong. Whenever >> something is not working it is worth looking at the html. >> >> >Are you sure you should not be using f.select rather than select_tag? >> >You should use form_for whenever appropriate rather than form_tag. > > This is just i tried.. > > >> >> <%= form_tag(:controller => "home", :action => "create", :method => >> "post") do %> >> >> <%= label_tag("City") %> >> >> <%= select_tag( "<option value=1>c1</option> >> >> <option value=2>ctnry</option> >> >> <option value=3>cntry</option> >> >> <option value=4>cntry</option>" , :class => "span2" ) %>Are you asking for more help or what? Did you check the html output (view source in browser) and have a look at the docs for select_tag? You will easily find examples of how to use it. And as I said you should be using form_for and f.select anyway. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.