Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Re: onSubmit Validation


Message #1 by "james" <jamesong74@h...> on Wed, 23 Jan 2002 10:33:21
Instead of using two functions in your onSubmit, only use one.  When I have
multiple validation scripts to run I generally write another function whose
sole job is returning the value of any other validation scripts I need to
run.

Like this:

onSubmit="return validate(this);"

function validate()
	{
	return useridCheck(blah) & passwdCheck(blah);
	}

Patrick

-----Original Message-----
From: james [mailto:jamesong74@h...]
Sent: January 23, 2002 10:41 AM
To: javascript
Subject: [javascript] RE: onSubmit Validation


Hi,
I have almost the same problem. When I submit the form, I will call 2
functions which will check the userid and the password. But it seems to be
only checking the first function.

<form
action="http://localhost:8080/examples/servlet/mysonyidfinal2.Servlet2"
method="get" onSubmit="return useridCheck(this.PASSWD.value);return
passwdCheck2(this.PASSWD.value)">

Please advise why the second function is not called. I have tried using
the code given below but it does not seem to work for my case.


> Hi,
>
> I find that the best approach is on the on submit of the form where a
true
> return allows the submit and a false return stops it as follows:
>
> <form ID="frmDisplayCalendar" method="GET" target="CalendarDisplay"
> action="CalendarDemo.asp" OnSubmit = "return ProcessSubmit(this)">
>
> Good Luck,
> Christopher Koniges
> Database/WEB Systems Programmer
> Tel:  (xxx) xxx-xxxx
> www.jazzysystems.com
>
> -----Original Message-----
> From: Howard Stone [mailto:zzzing@a...]
> Sent: Monday, March 12, 2001 12:03 AM
> To: javascript
> Subject: [javascript] onSubmit Validation
>
>
> I need some help on a form I am making.  The form is for someone buying
> online and I need to validate so that the form is not submitted with
> missing info.
>
> The form contains:  name and address, cerdit card info,  etc.  I did the
> calidation using the onBlur() method at each text field but someone
> suggested that would lock the end user to fill in the form from beginning
> to end.  The person suggested I validate when the form is submitted so
the
> end user can fill it in in any order.
>
> I like that idea but it does not seem to be working when I write:
>
> <input type = "submit" name = "submit" value = "Submit Form"  onClick 
> "return validateFirstName()" onClick = "return validateLastName()"
onClick
> = "return validateStreetAddress()">
>
> I have written the various functions in the head of the document.
>
> It does not seem to be working with more than one onClick function call.
> Could someone assist me how to do this.
>
> Thank you most sincerely



  Return to Index