hi i want to create a drop down list in the where the data of it will be taken from a database table. so i cam across the following way. one is don in the HTML way and other one is done in the ROR way. ################### 1st one ######################################## <select id="question_id" name="user[recovery_question]"> <% if @password_recovery_question_id == 0 or @password_recovery_question_id == nil %> <option value="" selected="selected" >Please Selected An Question</option> <% end -%> <% @questions = PasswordRecoveryQuestion.find(:all, :order => "question") @questions.each do |questions| %> <option value="<%= questions.id %>" <% if @password_recovery_question_id =questions.id -%> selected="selected" <% end %>> <%= questions.question %> </option> <% end %> </select> ################################################################# ################### 2nd one ######################################## <%= @questions = PasswordRecoveryQuestion.find(:all, :order => "id") collection_select("password_recovery_question", "recovery_question", @questions, "id", "question") %> ###################################################################### here int the second way i found difficult to add a default value to the top of the list as "-- SELECT YOUR OPTION --" Also i did not able find a working method to validate the drop down list for weather it has been select or not and display the error msg in front of the drop down list in red color. pls some body help me -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---