required for a 1st check before submitting a form.
<form action="myform.php"> Foo: <input type="text" name="someField" required="required"> <input type="submit" value="submit"> <input type="submit" value="ignore"> </form>
Problem is, that I have an "ignore" button, which submits the form as well and the backend logic then sets a correct state in a DB. In this case (ignore) the validation is not desired (because there is no need to fill in field "Foo").
What's the best way to handle the 2 scenarios?
- I could use some Js
onclickfor the ignore button scenario and remove the attribute just before sending the form ( https://stackoverflow.com/a/13951500/356726 ).
But actually I am looking for something smarter ....
--- Edit ---
Yes, duplicate of Required attribute HTML5