Hi Guys
While reaesrching about the web form validation, I came across this simple but nifty code which actually places the cursor in the required field, just add .focus(); syntax after mandatory field and will work.
function validateForm(formname)
{
if(document.forms. formname.requiredfield.value=="")
{
alert("Please enter……...");
document.forms. formname. requiredfield.focus();
return false;
}
Resource: http://www.w3schools.com/js/js_form_validation.asp
Friday, October 24, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment