Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Drop Down List

Participant ,
Oct 20, 2008 Oct 20, 2008
I have categories stored in my database and being access by my drop down list. My question is how will I view the sub categories stored in my database in the next page just by clicking the category in the drop down list without using a button? Thanks in advance!!!!
TOPICS
Advanced techniques
586
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 20, 2008 Oct 20, 2008
without a button, you will have to do it with javascript.
the simplest thing is to add an onChange event to your select element
which will relocate the user to the next page, passing selected value as
url variable:

<select name="myselect"
onChange="window.location.href='nextpage.cfm?cat='+this.value;">

the above will take the user to nextpage.cfm?cat=[value of selected
option]. so on the nextpage.cfm query your db to get the subcategories
that belong to #url.cat# category.

there are other, mo...
Translate
LEGEND ,
Oct 20, 2008 Oct 20, 2008
without a button, you will have to do it with javascript.
the simplest thing is to add an onChange event to your select element
which will relocate the user to the next page, passing selected value as
url variable:

<select name="myselect"
onChange="window.location.href='nextpage.cfm?cat='+this.value;">

the above will take the user to nextpage.cfm?cat=[value of selected
option]. so on the nextpage.cfm query your db to get the subcategories
that belong to #url.cat# category.

there are other, more complicated ways to do it: you may want to google
"two selects related", which will show you how to populate a second
select element on the same page based on selection in the first select
element.

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2008 Oct 20, 2008
Make sure you indentify yourself on the page with the form so that any keyboard users can hunt you down and shoot you for building such a user unfreindly app.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2008 Oct 20, 2008
LATEST
hehe. agreed. but sometimes client's requirements are requirements.
but i would probably still place a button next to the select as well...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources