Before the user submits any forms, it is very necessary to check whether all the required fields are filled or not. If the programer fails to implement required field validator in HTML forms, lazy users will skip all the necessary fields and so it leads to get only minimal details.
var textbox1 = document.forms["form1"]["user_name"].value;
if (textbox1 == null || textbox1 == "")
alert("User name must be filled out");
<form name="form1" action="" onsubmit="return validateForm()">
<input type="text" name="user_name"/>
What is the syntax for HTML required field validator:
Click Here to get -- > HTML Tutorials by Studentsblog100