Tizag.com Webmaster Tutorials - A collection of webmaster tutorials from HTML to PHP.

Friday, August 10, 2007

Form Validation while Submit

function blogsFormValidations(formNm)
{
form_feilds_mynames = new Array("Topic","First Name"," Last Name","Email Id","Post Fourm");

form_feilds_names = new Array("txtBlogtopic","txtFirstName","txtLastName","txtEmail","textarea");

if(!check(formNm,form_feilds_mynames,form_feilds_names)){
return false;

}else if(formNm.txtBlogtopic.value=="")
{
alert("Cannot Submit!!\n\n Please Insert Topic.\n");
formNm.selSalutation.focus();
return false;

}else if(checkEmail(formNm.txtEmail.value))
{
alert("Please Enter Valid Email.\n");
formNm.txtEmail.focus();
return false;
}else {
formNm.action.value='send_query';
formNm.submit();
}
}


onclick="javascript:blogsFormValidations(document.frmPostBlogs);"

No comments: