Web Analytics Made Easy -
StatCounter 2 lists - CodingForum

Announcement

Collapse
No announcement yet.

2 lists

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2 lists

    Hello,
    I have two dropdown lists on a form. How can I make it so the user must select from list a or list b but not both?

    Thanks for any help.

  • #2
    Do the select tags have size > 1? and select multiple?
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      hi glenngv,
      List A consists of Canadian Provinces, and List B consists of States. I want the applicant to choose only one state or one province. They must make a selection from one list only.
      Thanks for your help, I appreciate it.

      Comment


      • #4
        <select name="province" size="5" onchange="document.yourformname.state.selectedIndex=-1">

        </select>
        <select name="state" size="5" onchange="document.yourformname.province.selectedIndex=-1">

        </select>

        change the size to anything greater than 1 and yourformname to your appropriate form name


        Originally posted by Beginner
        hi glenngv,
        List A consists of Canadian Provinces, and List B consists of States. I want the applicant to choose only one state or one province. They must make a selection from one list only.
        Thanks for your help, I appreciate it.
        Glenn
        vBulletin Mods That Rock!

        Comment


        • #5
          Hello,
          Thanks so much, it's exactly what I needed.

          Comment


          • #6
            Greetings,
            Is it possible to ensure that a selection has been made from one list or the other, via an 'alert' if both are left unselected?
            Thanks for any help.

            Comment


            • #7
              function check(){
              frm = document.yourformname;
              if (frm.province.selectedIndex==-1 && frm.state.selectedIndex==-1){
              alert("You must choose a province or a state.");
              return false;
              }
              //other checking here

              return true;
              }

              <form onsubmit="return check()" ...>

              Originally posted by Beginner
              Greetings,
              Is it possible to ensure that a selection has been made from one list or the other, via an 'alert' if both are left unselected?
              Thanks for any help.
              Glenn
              vBulletin Mods That Rock!

              Comment

              Working...
              X