4 replies
I know the code is out there, I just can't find it.

I'm looking for a form with a dropdown menu that narrows a search.

For example:

first dropdown would be: Chevy, Ford, Dodge

if Chevy is selected then the next drop down box would be Camaro, Corvette

if Corvette is selected then the next box would be 2009,2008 etc...

you get the idea.

Is there a simple code for this?

thanks in advance.
#code #form #needed #search
  • Profile picture of the author LenD
    Originally Posted by moodykitty View Post

    I know the code is out there, I just can't find it.

    I'm looking for a form with a dropdown menu that narrows a search.

    For example:

    first dropdown would be: Chevy, Ford, Dodge

    if Chevy is selected then the next drop down box would be Camaro, Corvette

    if Corvette is selected then the next box would be 2009,2008 etc...

    you get the idea.

    Is there a simple code for this?

    thanks in advance.
    There's not a plug and play form that's going to do that for you. You'll need to have something developed that uses SQL and your site's programming language, or Ajax, or JavaScript, depending upon where your data is stored and how you want to go about retrieving it.

    If you tell us your actual need and a bit about your site, PHP, ASP, pure HTML, etc., someone can probably point you in a more clear direction.
    {{ DiscussionBoard.errors[1590780].message }}
  • Profile picture of the author mywebwork
    Yes, this is a job for an AJAX-based design.

    Essentially choosing an item from the first drop-down would trigger a JavaScript function which sends the data back to the server in the background, probably using something like JSON. The call to the server would also have a "callback" function specified.

    The server would query a MySQL table with the value ("Chevy" in your example) and return it's response to the callback function on the page. The callback function would use JavaScript to update the 2nd drop-down box with the values retrieved from the server, without refreshing the page.

    This process would continue until you reached the last drop-down menu.

    If you are going to build something like this you could use a library like JQuery or MooTools to do all the heavy lifting. Once you understand how to build AJAX interfaces you won't find this to be too difficult, but as for a "simple code" it's not that likely - sorry!

    Bill
    {{ DiscussionBoard.errors[1590959].message }}
  • Profile picture of the author moodykitty
    Thanks guys, thought it was easier than that.
    I wish I knew more about programming, sometimes I get lucky and figure out what I need but not this time!
    I haven't decided if this is the route I want to go yet....seems like a lot of work.
    Signature
    I would rather live my life as if there is a God, and die to find out there isn't, than live my life as if there isn't, and die to find out there is.
    {{ DiscussionBoard.errors[1591333].message }}
  • Profile picture of the author mywebwork
    It's not really that much work, here is an example using JQuery:

    Auto-populating Select Boxes using jQuery & AJAX

    Bill
    {{ DiscussionBoard.errors[1592158].message }}

Trending Topics