This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes onSubmit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onSubmit" Watch "onSubmit" New topic
Author

onSubmit

michell rosvlet
Greenhorn

Joined: May 22, 2009
Posts: 23
I have a form which should validate 2 function after submit. I am not sure whether this is the right way.





Both the functions when evaluated in single are working fine. But when I combine them then only the first one get's called in this case checkBox();
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60767
    
  65

Not right.

Remember, whatever you put in the onsubmit attribute for the element forms the body of the function that serves as the event handler. If the first statement of a function is a return, can it ever execute a second statement?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60767
    
  65

Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

A title such as "onSubmit" is pretty brief and non-descriptive. What would happen if all posts had such a title?

Please go back and change your post to add a more meaningful subject by clicking the button on your post.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd also recommend indenting your JavaScript code to make it legible.
michell rosvlet
Greenhorn

Joined: May 22, 2009
Posts: 23
Bear Bibeault wrote:Not right.

Remember, whatever you put in the onsubmit attribute for the element forms the body of the function that serves as the event handler. If the first statement of a function is a return, can it ever execute a second statement?


Thankyou so much I got the problem.
 
 
subject: onSubmit
 
Similar Threads
Online Quiz Application
checkbox
Button not getting disabled
help in radio button
no data in base