Solved

Form with multiple onsubmit checks

Posted on 2008-10-15
6
522 Views
Last Modified: 2013-12-25
I have a couple functions in a form's OnSubmit event.
<form name="frm1" method="POST" action="show.asp" onsubmit="return CheckFrm1();return DoThisToo();">
But only one get's executed. Can I put multiple functions here?

Also is there an order of events (which get's ececuted first) Left to right?
0
Comment
Question by:StevenJames
  • 2
  • 2
  • 2
6 Comments
 
LVL 16

Expert Comment

by:sh0e
ID: 22727759
<form name="frm1" method="POST" action="show.asp" onsubmit="CheckFrm1();DoThisToo();">

return stops execution and gives a value to onsubmit.
0
 
LVL 16

Expert Comment

by:sh0e
ID: 22727760
left to right
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 125 total points
ID: 22728510
StevenJames,

Can't you combine them or create a third that runs those functions and returns true/false to the submit?

If not then try ...

onsubmit="return (CheckFrm1() && DoThisToo());"

I haven't tried it like that so let me know if it doesn't work.  In a quick test it worked for me. :)

Let me know if you have any questions or need more information.

b0lsc0tt
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 4

Author Closing Comment

by:StevenJames
ID: 31506595
Thanks for the kick in the pants. lol
0
 
LVL 4

Author Comment

by:StevenJames
ID: 22731219
Thanks b0lsc0tt,

You gave me the idea of looking at other events, and since the user clicks on the submit button, I put the check in there, then my todostuff in the form's OnSubmit.

Works!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 22734613
Great!  Your welcome!  I'm glad I could help.  Thanks for the grade, the points and the fun question.
bol
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question