I'm not very good with forms and am having a great deal of difficulty with what should be a simple problem.
I have a form which contains the following:
<select id="values" name="Choice">
<option value="choose">Please Choose...</option>
<option value="01">Value 1</option>
<option value="02">Value 2</option>
</select>
All I want to do is stop the form from submitting if neither value-01 or value-02 are selected but the disabled option doesn't work.
How can I achieve this?
UPDATE:
I'm already using javascript to check the form, but this does not seem to work.
function submitForm() {
if (formObj.Choice.value == '') {
alert("Please select a value");
return false;
}
return true;
}
UPDATE 2: In answer to @h4b0 question:
<input type="submit" value="Search" class="screen-reader-text button cf" name="SubmitButton" onclick="return submitForm();">
No comments:
Post a Comment