I need when user not select any database value option tag print error color in to parent div. I used that code for <input type="text">
html tag code to print text field pattern not matching time printing error. code is below
<label class="col-md-3 control-label">Product Title</label>
<div class="col-md-6">
<input type="text" name="product_title" class="form-control" required
placeholder="Product Name" value="" pattern="([A-z0-9À-ž\s]){2,}"
oninvalid="setCustomValidity('Please enter least two characters long name')"
onblur="this.parentNode.parentNode.style.backgroundColor=/^([A-z0-9À-ž\s]){2,}/.test
(this.value)?'inherit':'orange'" >
</div>
That is done for me onblur
event.
Then now i want print error color when user not select any database value option in
<select></select>
tag. this is the default value i given. <option>Select a Manufacturer</option>
I need print error when user select this or forget select database values in that <option>
tag.
This is the code section
<div class="form-group"> <!-- form-group Start -->
<label class="col-md-3 control-label"> Select a Manufacturer </label>
<div class="col-md-6">
<select class="form-control" name="manufacturer" required="required">
<option>Select a Manufacturer</option>
<?php
$get_manufacturer ="select * from manufactures";
$run_manufacturer = mysqli_query($con, $get_manufacturer);
while($row_manufacturer = mysqli_fetch_array($run_manufacturer)){
$manufacturer_id = $row_manufacturer['manufacturer_id'];
$manufacturer_title = $row_manufacturer['manufacturer_title'];
echo "<option value='$manufacturer_id'>$manufacturer_title</option>";
}
?>
</select>
</div>
How can i do this?