Jump to content

Recommended Posts

Not sure if this has been asked before. I was given this task to make the product categorized according to size, car year, trim, etc. Ex. show results on Moto Metal wheels sizes that will fit selected a certain model of trucks. Like those on Tirerack: http://www.tirerack.com/content/tirerack/desktop/en/wheels.html

 

Any tips or lead will be appreciated. TIA

Link to comment
https://forums.phpfreaks.com/topic/304284-multiple-drop-down/
Share on other sites

You will want to implement an AJAX solution. This is sometimes called a "chained select" implementation. You can google that for some possible solutions. Here are the basics.

 

  • Implement JavaScript triggers on the Select lists that are parents for the onChange event
  • Whenever a parent select list is changed call a function to:
  • Pass the currently selected value via AJAX to get the list of applicable options for the immediate child select list
  • Empty out the options from the child and grandchildren select lists, then replace the options for the immediate child element

You need to decide whether you want a "select one" as the default option when populating the options of a child element (I would) or if you want to default to the first valid value. If you do the latter, you need to run the same process on that child element, and the next (recursively), until all parent/child elements are run.

Edited by Psycho
  • Like 1
Link to comment
https://forums.phpfreaks.com/topic/304284-multiple-drop-down/#findComment-1548173
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.