selected option problem
I have a drop down menu created with a select tag and i use two option tags for putting the following values in it:
1. "Select All"
2. The rest of the values which come from a query from a database.
Each time I enter the page I want to have selected as a first option, the previous selection and if there is no previous selection (if I enter the page for the first time or never used this menu before), I want pre-selected the "All" option.
The code up to now -without using the "selected" attribute- looks like this:
I would appreciate any help.
r u storing the previous selection in Database?
If not, u can store the selected value in a Cookie(before the submitting the form).
And while the page loads, the Cookie value needs to be checked and if some value is present, compare it with each of the values retrieved from the database and make the appropriate option "selected".
i do have access to the name and value of the option previously selected.
But since this previous option is one of the many possible which come from the <c:forEach> loop, i can't tell where to put the "selected" attribute.
If you're not storing the previous value in database, then you have make the default selection using Cookies.
chk this site.. it'll be a gud start to work on Cookies
or search for examples on Cookies. u'll find lots of them online.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)