Drop down list in a form - how to filter ?

M

Maxime

Hello,

I've created several forms using .asp pages in FP 2000 in
order to load data into a MS Access database.

For each field, user has to select value among a list
(thank to a drop down list), values proposed are a
database result.


There are 5 fields in the form = Is it possible to use the
value selected by user in one field as a filter for
another one ?

For example, if I want to load into the database the
fields "continent" and "country". I create into the
database one table "continent" , and one table "country" ,
each databae contain only one column.
In the form, user is supposed to select first the
continent from a drop down list, which is a database
result of the table "continent" and then the country,
which is the database result of the table "country". At
this stage, I would like that countries proposed in the
drop down list would be only those of the continent
selected just before and not all the countries from the
table "countries".

thank you for all your remarks !
 
T

Thomas A. Rowe

The simplest solution for doing this, is to step the user thru 5 steps, if
you want to maintain all values in the database:

Step 1: User select Continent
This posted to a page the then display only those countries on the select
Continent and stores the Continent value in a session or hidden form field,
if needed in the final step.

Step 2: User select Country

and so on.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

maxime

thank you for your quick feed back.

your proposition is ok but it means that process to "feed"
database will be longer and quite heavy as user will have
to enter each value into a different page. I have some
forms where user has to enter more than 10 different
fields, I can't imagine that he has to split his data
entry into 10 different steps. Here, it is a must that
user enter all fields through a single page.
is there any other solutions allowing these needs ?

thank you !!
 
J

Jon Spivey

It might be more intuitive to have the dropdowns for continent and country
on the same page, with one continent selected (obviously whichever continent
most users are in) and the country dropdown populated with that continent's
contries. So you might have
<select name="continent"...
<option selected value="Europe">Europe</option>
<option value="Asia">Asia</option>
etc.......
<select name="country"....
<option value="united kingdom">UK</option>
<option value="france">France</option>
etc........

Then add an onchange to the continent listbox
<select name="continent" onchange="this.form.submit();">
so when a user chooses a different continent the form is submitted and the
country box repopulated with the appropriate contries. That's how I'd do it.
 
T

Thomas A. Rowe

If coded correctly, the time spend will not be that much longer than filling
in the single page, plus depending on what you are trying to accomplish
overall, these extra step could allow you to do additional validations or
the looking up of additional data that can then be filled in, in the next
step, etc.

To do it way you would like to see it would requires create multiple
recordsets, that they must be loaded into a JavaScript Array, that would
automatically change based on a selection in one or more drop down menus.
The time to wait for a page to load with this, depends on the total amount
of data that will need to pre-load, and the speed of the user's internet
connection, and you server.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top