Couldn't find anything quite what I was looking for but if I've missed something obvious I'm sorry. I'm basically trying to have a JavaScript function check that each of a number of select boxes have unique values before the form is submitted to then be entered into a database.
There could be any number of select boxes but all follow a similar naming format in the form of:
operator_address_type_0
operator_address_type_1
operator_address_type_2
etc.
I was just wondering how a JavaScript function could be set up to loop through all of the select boxes and alert the user and stop the submitting if any are found to have the same value.
Thanks for any help.
EDIT:
Here is some simplified HTML of my current select boxes. I've had to simplify it a lot as the table that they are in is all loaded via AJAX from querying a database.
<select name="operator_address_type_0">
<option value="Main">Main</option>
<option value="Payment">Payment</option>
<option value="Poster">Poster</option>
</select>
<select name="operator_address_type_1">
<option value="Main">Main</option>
<option value="Payment">Payment</option>
<option value="Poster">Poster</option>
</select>
It is like that but there could be more options in the future, I just want to check that there is only one main address, one payment address, one poster address etc.