SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: dropdown list selection
-
Feb 28, 2004, 01:34 #1
- Join Date
- Jul 2002
- Posts
- 28
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
dropdown list selection
Hi,
I know I'm supposed to search the forum for answers before posting but I can't really seem to find the right word for my search. The search feature has been really helpful lately but this time I'm outta clues....
Here is what I'm trying to accomplish: I've got a dropdown list that is populated via a php script. Whenever the user selects a value from the list, they have to click on the 'submit' button in order to retrieve the values. I don't want this .... I don't want them to click on the button, rather, retrieve the values from the DB immediately upon selection of a list item. Its like ... I select a value from the dropdown list and it automatically uses its value to retrieve relevant details from the DB, no need to click on any button or anything. How do I do this with js ? Can I accomplish the same with php as well (don't think so ?)
I hope I'm clear ...
any help is much appreciated.
regards,
mankool
-
Feb 28, 2004, 07:48 #2
- Join Date
- Feb 2002
- Location
- Geneva, Switzerland
- Posts
- 74
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You should be using the select's onchange event handler.
For example:
Code:<select onchange='...javascript...'> </select>
-
Feb 28, 2004, 11:25 #3
- Join Date
- May 2003
- Posts
- 1,843
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You didn't mention whether you wanted to refresh the page or not; there are ways of doing this that avoid a reload entirely. If that's not an issue, you can submit the form directly from the select list:
Code:<select........onchange="if(selectedIndex!=0)this.form.submit()"> <option>dummy</option> <option value="aaa">choice</option> <option value="bbb">choice</option> ........
::: certified wild guess :::
-
Mar 25, 2004, 11:46 #4
- Join Date
- Jul 2002
- Posts
- 28
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the help ... working just as I wanted
thank you (both of you)
Bookmarks