JavaScript Forms Validation

Google Advertisements

Prev Tutorial Next Tutorial

JavaScript Forms Validation

Forms validation is important things other wise user input wrong data, so we need to validate given data by user before submit it on server.

The JavaScript provides the facility to validate the form on the client side so processing will be fast than server-side validation. So, most of the web developers prefer client side form validation using JavaScript.

Here i will show you how to validate any input field like user name can not be blank. In below example input are can not be blank.


function form_validation(){  

//var x = document.forms["myform"]["name"].value;
if (name==null || name==""){  
  alert("Name can't be blank");  
  return false;  

<form name="myform" method="post" action="register.php" onsubmit="return form_validation()" >  
Name: <input type="text" name="name">  
<input type="submit" value="submit">  



Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements

Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: or 8076671483 Try this Keyword C++ Programs