Dropbox query

Discussion in 'Web Design' started by jayk, Nov 19, 2015.

to remove all ads.
  1. jayk

    jayk New Member

    Messages:
    9
    I have three drop boxes all with the same info in list. But i want to make it that if you choose one of the option in the one drop box you can't select the same option in another. Any advice? Thank you
     
  2. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,662
    By "drop box" do you mean HTML select elements or "DropBox" accounts??
     
  3. jayk

    jayk New Member

    Messages:
    9
    Yes that is correct
     
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,662
    Okay, I'll assume you only answered the first if the two question, based on the second being more improbable of being correct.

    But what you need to do is;

    when any select box is changed, you trigger a function that disables the others. I might write some example code for that later on.

    However:
    A much simpler way and the one I would choose to use as it avoids the unnecessary reliance of javascript, is to use a single select element with <optgroup> elements separating the mutually exclusive choices. This may of course require some layout changes but given that this IS the "Web Design" section of the forum it seems to be an eminently more suitable solution.
     
  5. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,662
    Oops, just found out that there is no "edit post" function so I cannot correct my typo of 'if' to 'of'
     
  6. Phreaddee

    Phreaddee Super Moderator Staff Member

    Messages:
    1,978
    yes this is actually a valid use case for <optgroup>
     
  7. jayk

    jayk New Member

    Messages:
    9
    Thank you yet again chrishirst. Really appreciate the guidance. Will study up on it.
    <optgroup> thank you
     

Share This Page