the required attribute does not work in this form. How can this be fixed?
<form id="regform" action="PersonalDataAgreement.jsp" method="post" name="registration_form">
<div >
<div >
<input type="text" placeholder="familyname" name="familyname" id="familyname" required>
</div>
<div >
<input type="text" placeholder="firstname" name="firstname" id="firstname" required>
</div>
<div >
<input type="text" placeholder="secondname" name="secondname" id="secondname" required>
</div>
<div ><a href="#" onclick="document.getElementById('regform').submit()">Register</a></div>
</div>
</form>
CodePudding user response:
Calling the form's submit()
method bypasses the validation step.
Use a real submit button instead. Apply CSS to make it look the way you want.
<button>Register</button>
CodePudding user response:
Write this way
required="required"
CodePudding user response:
Change your "register" button to:
<div ><button>Register</button></div>
And it works fine.