[Javascript] multiple onSubmit events not working

Ed Curtis ed at homes2see.com
Thu Sep 1 13:34:35 CDT 2005


 I got it working now. I did the return (function1() && function2() &&
function3()) as outlined but it still didn't work correctly. What I had to
do was make sure every function returned true just by adding it to the end
of each function. Thanks again.

Ed


On Thu, 1 Sep 2005, Mike Dougherty wrote
> what happens if you do: onsubmit=" return ( function1() && function2() & function3() ); "
>
> If any of the functions return false, the form will not submit - it wouldn't be very friendly if
> each function reported problems...
>
> It would probably be much nicer to have a handler function that called each subroutine and reacted
> appropriately for the return; so if function1() returns false, to not call function2() or
> function3()
>
> On Thu, 1 Sep 2005 10:50:32 -0400
>   Amol Katdare <amol.forums at gmail.com> wrote:
> > <form name="form" action="dothis.php" method="post" onSubmit="return
> > check_upload_required(); openpopup(); submitonce(this);">
> > To invoke all the 3 methods, just remove the keyword "return".
> > i.e.
> > <form name="form" action="dothis.php" method="post"
> > onSubmit="check_upload_required(); openpopup(); submitonce(this);">
> >
> >
> > On 9/1/05, Ed Curtis <ed at homes2see.com> wrote:
> >>
> >>
> >> I tried the mentioned process but the submit button on the form does not
> >> disable. Any suggestions?
> >>
> >> 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
> >> >
> >>
> >> _______________________________________________
> >> Javascript mailing list
> >> Javascript at LaTech.edu
> >> https://lists.LaTech.edu/mailman/listinfo/javascript
> >>
> >
> >
> >
> > __________________________________________________________
> > This message was scanned by ATX
> > 10:55:23 AM ET - 9/1/2005
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list