S SS Dec 15, 2004 #1 I want to be able to validate two drop down boxes so at least one must have been selected. Is there a way to do this? Cheers Shona
I want to be able to validate two drop down boxes so at least one must have been selected. Is there a way to do this? Cheers Shona
S Stefan B Rusynko Dec 15, 2004 #2 Yes but only w/ a custom JavaScript - not FP validation -- | I want to be able to validate two drop down boxes so at least one must have | been selected. | | Is there a way to do this? | | Cheers Shona | |
Yes but only w/ a custom JavaScript - not FP validation -- | I want to be able to validate two drop down boxes so at least one must have | been selected. | | Is there a way to do this? | | Cheers Shona | |
S SS Dec 15, 2004 #3 Yes that is what I thought but was rather hoping someone would post how to do it Cheers Shona
J Jon Spivey Dec 15, 2004 #4 Hi Shona, Something along these lines. <script type="text/javascript"> function checkBoxes(f){ if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){ alert("Your Error Message"); return false;} return true; } </script> <form onsubmit="return checkBoxes(this)"> <select name="drop1"> <option value="">Choose Something</option> <option value="option1">Option 1</option> etc </select> <select name="drop2"> <option value="">Choose Something</option> <option value="option1">Option 1</option> etc </select>
Hi Shona, Something along these lines. <script type="text/javascript"> function checkBoxes(f){ if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){ alert("Your Error Message"); return false;} return true; } </script> <form onsubmit="return checkBoxes(this)"> <select name="drop1"> <option value="">Choose Something</option> <option value="option1">Option 1</option> etc </select> <select name="drop2"> <option value="">Choose Something</option> <option value="option1">Option 1</option> etc </select>
J Jon Spivey Dec 15, 2004 #5 Typo - this if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){ should be if(f.drop1.selectedIndex ==0 && f.drop2.selectedIndex==0){ Capital I Jon
Typo - this if(f.drop1.selectedIndex ==0 && f.drop2.selectedindex==0){ should be if(f.drop1.selectedIndex ==0 && f.drop2.selectedIndex==0){ Capital I Jon