2016-09-02 8 views
0

私は状態のドロップダウンメニューを持っています。そして、正しい状態を入力してリストの一番上に表示し、私がそれをしたいと思っているのは、リストの一番上に表示し、州のリストの正しい場所から取り除くのではなく、その州に行くことです。あなたはこのような何かを書くことができます任意のヘルパーなし正しい方法で正しい情報を自動入力するための状態のドロップダウンメニューを取得する方法

<label for="state">State</label> 
    <select class="form-control" id="state" name="state"> 
    <% options = ["Alabama","Alaska","Arizona","Arkansas","California","Colorado", 
"Connecticut","Delaware","District Of Columbia", 
"Florida","Georgia","Hawaii","Idaho","Illinois", 
"Indiana","Iowa","Kansas","Kentucky","Louisiana", 
"Maine","Maryland","Massachusetts","Michigan", 
"Minnesota","Mississippi","Missouri","Montana", 
"Nebraska","Nevada","New Hampshire","New Jersey", 
"New Mexico","New York","North Carolina", 
"North Dakota","Ohio","Oklahoma", "Oregon", 
"Pennsylvania","Rhode Island","South Carolina", 
"South Dakota","Tennessee","Texas","Utah","Vermont","Virginia", 
"Washington","West Virginia","Wisconsin","Wyoming"]- [customerinfo[0]['state'] ]%> 

<option value=<%= customerinfo[0]['state'] %>><%= customerinfo[0]['state'] %></option> 
    <% options.each do |option| %> 
    <option value=<%=option%>><%=option%></option> 
    <% end %> 
</select> 
+0

(HTTP [私はHTML