Reputation: 227
i doing a small project in django by using python. In that admin can add tasks with high,medium or low priority in database. THen he can see the status of tasks i.e. completed or pending. I am able to dynamically populate a table with data of pending tasks. Above the table, I have given a dropdown box with all priority. As admin selects low priority and click button it shows list of low priority tasks. Then the value of dropdown box get changed and shows first value in the options. As per convention it should shows as per the displayed data i.e. if table has low priority tasks then the value of dropdown should be low, similary for others it should not changed to first opotions. How to implement this functionality..please somebody help me.. .thanks for your time..
Upvotes: 0
Views: 263
Reputation: 174624
When you display the data after the user selects the priority, change the add the selected
attribute to the option that you want selected by default.
<select>
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
In the above, the first option One
will be selected by default.
<select>
<option>One</option>
<option selected>Two</option>
<option>Three</option>
</select>
In this sample, Two
will be selected by default.
Upvotes: 2