[Javascript] multiple onSubmit events not working

Ed Curtis ed at homes2see.com
Thu Sep 1 07:17:53 CDT 2005


 Thanks, that's exactly what I was thinking about trying but I didn't
remove the return false from the event handlers in the
check_upload_required() function.

On Thu, 1 Sep 2005, Nick Fitzsimons wrote:

> >
> > I'm attempting to clear three functions with a single onSubmit form event.
> >
> > <form name="form" action="dothis.php" method="post" onSubmit="return
> > check_upload_required(); openpopup(); submitonce(this);">
> >
> > The check_upload_required function works as expected but the script never
> > executes the openpopup() or submitonce(this) functions. If I remove the
> > check_upload_required() from the onSubmit event the other functions work
> > as expected. Can anyone shed some light on why this is happening. I really
> > need for all three functions to work together.
> >
>
>
> When you use "return check_upload_required;" it does exactly that -
> returns with the value that came back from the function, and therefore
> stops processing any code after that point.
>
> Try defining a single function:
>
> function submitHandler(theForm) {
>    var result = check_upload_required;
>    if (result) {
>       openpopup();
>       submitonce(theForm);
>    }
>    return result;
> }
>
> and change the handler to
>
> onsubmit="return submitHandler(this);"
>
> HTH,
>
> Nick.
> --
> Nick Fitzsimons
> http://www.nickfitz.co.uk/
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list