Using the Onchange Command With a Drop Down List

Follow these instructions to make your drop down list auto submit when a selection is made.

Follow these instructions to make your drop down list execute when a selection is made instead of using a submit button.
You will place your drop down list in a form and set the form action to your
database results page. You use a Onchange event that uses the form name and is
added to the select tag. When you select a choice from the list, the selected
option will be submitted to a form handler when a selection is made
automatically.

Follow steps below:

1. Open a page that contains a drop down list, that when a option is selected
you want to submit to a results page.

2. Select the drop down list, from the Insert menu select the Form menu, and
click Form, this will create a form around your drop down list.

3. Right click the form, and choose Form Properties

4. In Form Properties, click Send to Other, click Options and enter a page name
that will be used to show results based on criteria, the value from this drop
down list we be passed to that page.

5. Enter a form name, like “Form1”, click OK to exit Form Properties.

6. In Page View, place the curser just in front of your drop down menu, and
click HTML view tab.

7. Locate the tag for the drop down menu, it will start with:

8. Add the following text to the Select tag, just after the name:

onchange=form1.submit()

It should look something like the example below:

This will specify which form name to use, choosing a selection from the drop
down list will submit the results to the form’s action.

9. Save and Preview the page.

Your final code will look like the example below:



NOTE: To make this work, you will need to create a database results region that
includes criteria. You will specify a database filed name and the value will be
the list box name, in our example the list box name is “Dropdown1”. Make sure
you check the box for “Use This Search Form Filed” when you specify criteria, in
the database results wizard.

Leave a Reply

Your email address will not be published. Required fields are marked *