Need help on "Next" and "Previous" functionality for a select dropdown
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Robin_Mehta
Posted On:   Wednesday, August 13, 2003 06:27 AM

Using the below code to display wells in a select dropdown list.




Now, I would like to have "Next" and "Previous" functionality for this dropdown. Initially, one of the options is selected in this dropdown.


When "Next" button is pressed, it should highlight the next option in the dropdown. Is it only possible in Javascript? Or it can be done using ActionForm? Any help will be appreciated.

Re: Need help on "Next" and "Previous" functionality for a select dropdown

Posted By:   Wayne_Andersen  
Posted On:   Friday, August 15, 2003 01:49 PM

There is another way to do this without Javascript at all.
Instead of using the
tag use logic: iterate to loop through your collection and manually search for the item to have selected using standard html tags.


In the following example I have a listbox that list all the rooms available. The first time through the page none is specificaly selected. But when the user makes a new selection in the listbox it submits a form via the onchange event. The action it calls creates a currentRoom bean and adds it to the session.


The following code iterates through the rooms collection, checks to see if a currentRoom exists if so, it defines a varaible, then uses logic equal to see if the current room in the logic:iterate loop matches. If it does it outputs a


































The result is a list box that submits on each change but defaults to the selected entry.

About | Sitemap | Contact