Hi I need Help in form validation , i have multiple(same) drop down values , i need to check on submit email is been selected i,e on submit email is mandatory fields, if email is selected in select3 and again im trying select same email in selct3 need to alert message to use "email is already been selected",except none other values need check with this condition and if email is not select on submit a alert message saying "please select the email address" <form id="dropdownvalue" name="search" method="post" action="sample1.php" onclick="validate();"> <div id="dropdownvalue"> <select name="select3[1]" class="mySelects" > <option value="None" selected="selected" > Search1</option> <option value="email" >Search2</option> <option value="firstname" >Search3</option> </select> <select name="select3[2]" class="mySelects" > <option value="None" selected="selected" > Search1</option> <option value="email" >Search2</option> <option value="firstname" >Search3</option> </select> <select name="select3[3]" class="mySelects" > <option value="None" selected="selected" > Search1</option> <option value="email" >Search2</option> <option value="firstname" >Search3</option> </select> </div> <input type="submit" value="submit"> </form>
I'd build this incrementally. IOW, select3[1] is filled in. If the user selects email, I'd build select3[2] without an email choice. Same for select3[3]. Then, before submitting (change the type of button from submit to button and run Javascript to check for an email choice), I'd check to make sure that at least one of the dropdowns had an email choice.