I have a form with several fields in which the option 'required' is set. Is there any way to know by DOM if all the fields are filled out before submitting? I mean I want to know if the DOM already contemplates the possibility of indicating if all the fields of a form have been filled out. I do not want to check the fields one by one with javascript.
HTML code:
<form id="form1">
<input id="campo1" type="text" required />
<input id="campo2" type="text" required />
<input id="continuar" type="button" onclick="formRellenado();" />
</form>
Javascript code (assuming there was a form method that told you if all the fields are filled in?):
function formRellenado() {
if (document.forms["form1"].rellenado) {
// hacer submit con una llamada a servidor mediante asp.net
}
else {
// no hacer submit
}
}