Page 1 of 1

javascript question

Posted: Thu Jul 08, 2004 12:29 am
by C_Calav
hi guys, decided to use javascript for validation but once i click submit the error message pops up and then still carrys on to the proccess page. i need it to stop after the error message so the user can type in name again.

thanx!

Code: Select all

var errormessage = "" 

function validate_form()
{
        errormessage = "You have the following errors:\n"
        
        Name()
	
        if (errormessage != "You have the following errors:\n")
        {
               alert(errormessage)
        }
}

function Name()
{
       var name = window.document.index.E_Name.value
	
       if (name == "") 
       {
       errormessage = errormessage + "- Please enter your name\n"
       }
}

Posted: Thu Jul 08, 2004 12:33 am
by PrObLeM
wrong forum... try the client side forum

Posted: Thu Jul 08, 2004 12:38 am
by C_Calav
thanx ok i will, sorry!

Posted: Thu Jul 08, 2004 12:48 am
by PrObLeM
no problem...it happens