I want to validate a textbox and a selectbox. The textbox may not be empty and the selectbox may not contain 'Kies een prijsstelling..' otherwise an errormessage is displayed.
I've got the coding below, but when I test it with the textbox empty and the selectbox focussed on the 'Kies een prijsstelling..' line, the error message ain't displayed. How come ?
my html:
Code:
Prijs*<br /><input id="prijs" name="prijs" style="width:75px;" type="text" value="<?php echo"$prijs" ?>" onblur="this.value=formatCurrency(this.value);" /> of
<select name="prijssoort" onchange="document.getElementById('prijs').value = '';">
<option value="1" selected="selected">Kies een prijsstelling..</option>
<option value="2">Bieden</option>
<option value="3">N.o.t.k. (Nader overeen te komen)</option>
<option value="4">T.e.a.b.</option>
<option value="5">Ruilen</option>
<option value="6">Gratis</option>
</select>
my php:
Code:
if ($prijs=='' && prijssoort=='1'){echo "Prijs of prijssoort is een verplicht veld";}