0

How to create a form in HTML and not allow users to submit unless they fill it correctly?

Html form

20th Aug 2020, 1:56 PM
Ziyad Aldoumany
Ziyad Aldoumany - avatar
3 ответов
0
You can disable the submit button by adding disabled attribute to the button tag by js if the form is invalid.
20th Aug 2020, 2:21 PM
Midhun Madhu
Midhun Madhu - avatar
0
depend on what defined correct. if correct means not empty, we can add required attribute if we need it to be at certain length of string add minlength and maxlength if its a number we have min and max and the big gun. pattern attribute. as long as the requirenent can be defined in regex pattern its your main weapon. html5 really up the form validation so that we dont really need to create an eventlistener just for that
20th Aug 2020, 2:31 PM
Rei
Rei - avatar
0
Use( required ) booleans and (type , pattern) attribute for form validation
20th Aug 2020, 4:10 PM
Divya Mohan
Divya Mohan - avatar