javascript question

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

javascript question

Post 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"
       }
}
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

wrong forum... try the client side forum
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx ok i will, sorry!
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

no problem...it happens
Post Reply