A required select in Chrome isn't working (in Firefox it works). My code is:
<form id='form_tbl' action='include/value.inc.php' method="POST"><input type="hidden" name="quiz" value="1">
<?php include "include/sel_tbl.inc.php"; ?>
</form>
and file sel_tbl.inc.php is:
<?php
...
echo "<table><tr><th>Name</th>><th>date</th><th>quiz</th><th>quiz2</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td><input type='hidden' name='id_pers[". $row['ID'] ."]' value='". $row["ID"]."'>" . $row["Name"]. ' '. $row["lastn"]. "</td>";
echo "<td><select name='nota_intr_1[". $row['ID'] ."]' required ><option disabled selected>nota</option>";
for($i=1; $i<=10; $i++){
echo "<option value='$i'>$i</option>\n";
};
echo "</select></td>";
echo "<td><select name='nota_intr_2[". $row['ID'] ."]' required ><option disabled selected>nota</option>";
for($i=1; $i<=10; $i++){
echo "<option value='$i'>$i</option>\n";
};
echo "</select></td>";
echo "<td><textarea name='sgs[". $row['ID'] ."]' form='form_tbl' maxlength='200' autocomplete='off' placeholder='test here...'></textarea></td></tr>";
}
echo '</table><button name="button_vot">send</button>';
?>
What is wrong with my code?
Required attribute causes a notification only if you are trying to submit an empty value from a required field. Give an empty value to the default selected option
<option value="" disabled selected>nota</option>
then it will notify, if a user does not select an option with a proper value.