NYCPHP Meetup

NYPHP.org

[nycphp-talk] Trapping JS errors in function called onSubmit

Kristina Anderson ka at kacomputerconsulting.com
Tue May 6 18:25:21 EDT 2008


thanks!!  will do.



> On Tue, May 6, 2008 at 5:59 PM, Kristina Anderson
> <ka at kacomputerconsulting.com> wrote:
> >
> >  Hi everyone --
> >
> >  I'm trying to build out a validation routine for my input forms and
> >  found something that I like/find easy to extend.  I added it as an
> >  external script to my test page.  I tested to make sure all the
> >  subfunctions were being called by inserting alert boxes and they 
are
> >  being called.  Unfortunately, the routine is not picking up my
> >  empty/non valid fields and instead appears to be just 
returning "true"
> >  and submitting the form.
> >
> 
> My guess is that your javascript has errors which prevents the submit
> handler from returning false.  This makes it really hard for
> debugging...
> 
> Try the following when developing:
> <form onsubmit="validate(this);return false;">
> instead of
> <form onsubmit="return validate(this)">
> 
> This way when "validate" errors out, the submission will still be
> trapped and you can see the errors in the console.
> 
> HTH,
> 
> -john c.
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 
> 




More information about the talk mailing list