1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Multi-Dropdown menu that can save input

Discussion in 'JavaScript' started by Bulldog-Designs, Apr 26, 2013.

  1. #1
    At the top of my site I have a 3 part drop down menu: Year, Make, Model.
    When they reach model and press GO they're takin to the appropriate page.
    How do I make it so it saves this customers chosen selection at the top so they can press
    "go" on any other page without having to re-select the data?
    thank you
     
    Bulldog-Designs, Apr 26, 2013 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    You need to store the information in cookie or you could ajax it into a database and retrieve it that way.
     
    HuggyStudios, Apr 26, 2013 IP
  3. Bulldog-Designs

    Bulldog-Designs Active Member

    Messages:
    912
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Any ideas on the code needed to store the users selection? I think Javascript would be pretty straight forward
     
    Bulldog-Designs, Apr 28, 2013 IP
  4. darrentaytay

    darrentaytay Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    23
    #4
    Are you using any sort of library such as jQuery on your site? This would make it much easier for storing and retrieving cookies.
     
    darrentaytay, May 1, 2013 IP
  5. scriptjerk

    scriptjerk Active Member

    Messages:
    43
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    58
    #5
    If you have access to sessions you can probably use them to store the data, but that would be more for traditional single select. You may want to json ajax to get the select options and selected option. Like a Country, State and City Select groups, the second and third select box's options are going to be different depended on what the previous ones select value was. Might be helpful to get the values and store them in sessions and place in hidden inputs and if detected simply dont show the top section where they make a selection. Make that a link they have to click to re-select.
     
    scriptjerk, May 1, 2013 IP
  6. imthebanana

    imthebanana Well-Known Member

    Messages:
    486
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    140
    #6
    its pretty simple with javascript, maybe even try the new html5 local data storage (which seems to be better than cookies).

    This script should help you quickly store the selections in cookies (for either php or javascript to process)

    https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js
     
    imthebanana, May 7, 2013 IP