Hello All,
I am having the drop down list with count 1 to 10 which is looped for itemlist. For item 1 dropdown list shows count 1 to 10,item 2 also dropdown list shows count 1 to 10 and so on. I want to preset the value for the drop down list which should display on page load like for item 1 drop down value count set to 1, for item 2 drop down value count set 2.. and so on. How can i acheive this please let me know. Code is attached for the drop down list. Want the solution in html/javascript/ruby on rails.

<select id="order_of_display" name="order[display]">
                                                    <option value="0" selected ="selected">Select order</option>


                                                            <% if  @items[:active] %>
                                                                 <%for i in (1..@items[:active].size) %>

                                                    <option value=" <%= i  %>" > <%= item.id %> </option>

                                                                <% end %>
                                                          <% end %>
                                                  </select>

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

I am having the drop down list with count 1 to 10 which is looped for itemlist. For item 1 dropdown list shows count 1 to 10,item 2 also dropdown list shows count 1 to 10 and so on.

What language is this? Is it JSP or ASP.net? Why did you post this in CSS?

The example has nothing to do with CSS, it seems it involve the database or an array?

Want the solution in html/javascript/ruby on rails.

What solution? What is active? How can anyone add a code with the code you provided? It doesn't make any sense.

It is always a good practice to keep your code clean and readable. You could do just that, then re-post it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.