Forum : How can we do validation without submitting any form.
Brief description  about Online courses   join in Online courses
View Ankit  Goel 's Profile

How can we do validation without submitting any form.

Actually I have 2 forms. one is Form1.php and second is result1.php. Form1.php is having 3 fields which are username, age and occupation. When I am validating this form it alert the message to fill the desired field and goes to result1.php. But I want that when all the fields are correctly filled then only the form1.php will submit and show the result in result1.php. How can i do this?

Thanks.
Asked by Ankit Goel | Apr 25, 2011 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
for every form you have to make separate java script function.on form submission call that function . In that function you have to write logic to validate that form like
name if(document.formname.fieldname.value==''){
alert("enter name");
}
Apr 26, 2011