By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,558 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,558 IT Pros & Developers. It's quick & easy.

How to update selection list contents from a server database based upon user data entry

P: n/a
I am trying to create a web page in which the contents of one selection list
depends upon which element in another selection list is chosen, but where
the information to populate the first selection list comves from an SQL
database on the web server.

There are a couple of these situations in my application but, for example,
the first list might be a list of counties, and the second list a list of
states/provinces. Obviously the names of counties depend upon which
state/province is chosen, but there are too many possibilities to be able to
embed them within the web page itself. So when the user selects a
state/province I need to go to the server to ask for the list of counties.

I have seen a number of posts that sort of address this issue. For example
it is suggested to use <script src="a URL"/> to ask the server side code to
send up data of type "text/javascript". However the examples do not seem to
address how the server side code would know which state/province the user
had selected.

If there is a web site that addresses this sort of thing, I would appreciate
any pointers.

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Don't have a web site for you, but I can recommend a strategy for its
implementation.

Every time someone makes a new selection in list #1 (to populate list
#2), the page has to submit a form to the server. The server will then
know (from the form contents) what was selected. It then has to
regenerate the same page, but populate list #1 with the end user's
selection and populate list #2 with the right contents based on that
selection.

To enable the form being submitted when the end user select from list
#1, this is where your javascript comes into play. I'll leave it up to
you to do the research on how to process an event that gets fired when
an html <select> changes its value. When that event fires, the form on
that page needs to get posted.

epp

Jul 23 '05 #2

P: n/a
In article <rZ********************@magma.ca>, jc*****@magma.ca enlightened us
with...

If there is a web site that addresses this sort of thing, I would appreciate
any pointers.


And to think I just wrote that up a couple days ago. :)

Here ya go.
http://www.ipwebdesign.net/kaelisSpa...SelectsDB.html
--
--
~kaeli~
If a turtle doesn't have a shell, is he homeless or naked?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3

P: n/a
Thank you. I honestly don't understand why such an obvious capability is
not documented in any of the Javascript cookbooks that I have read.

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP***********************@nntp.lucent.com...
In article <rZ********************@magma.ca>, jc*****@magma.ca enlightened us with...

If there is a web site that addresses this sort of thing, I would appreciate any pointers.


And to think I just wrote that up a couple days ago. :)

Here ya go.
http://www.ipwebdesign.net/kaelisSpa...SelectsDB.html
--
--
~kaeli~
If a turtle doesn't have a shell, is he homeless or naked?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

P: n/a
In article <7O********************@magma.ca>, jc*****@magma.ca enlightened us
with...
Thank you. I honestly don't understand why such an obvious capability is
not documented in any of the Javascript cookbooks that I have read.

You're welcome. :)
--
--
~kaeli~
To steal ideas from one person is plagiarism; to steal from
many is research.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5

P: n/a
Jim Cobban wrote:
Thank you. I honestly don't understand why such an obvious capability is not documented in any of the Javascript cookbooks that I have read.


(snip)

Probably missed this:

http://www.dhtmlcentral.com/tutorial...ials.asp?id=11

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.