tags:

views:

30

answers:

2

This is how I have implemented the

<select name="doctype" id="doctype" class="textarea" onchange="fillLabel()">
        <%
        DocumentManager documentManager = new DocumentManager();
        List keyTypes  = documentManager.getAllKeyTypes();
        Iterator ite = keyTypes.iterator();
        while(ite.hasNext()){
            Object[] row = (Object[]) ite.next();
        %>
        <option value="<%= row[1] %>"><%= row[0] %></option>
        <%}%>
    </select>

How do I persist the selected value when page got refreshed.

Thanks.

A: 

I think we couldn't persist selected value in a combo box.

Another solution is, when ever a change occurs in combo just store that value in database and retrieve that value next time. But it has some other limitations. I couldn't tell you more without knowing more about your necessity.

shinod
A: 

It's can be solved in javascript using cookie (or local storage is HTML5 is an option).

Boris