Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onSubmit

 
michell rosvlet
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd also recommend indenting your JavaScript code to make it legible.
 
michell rosvlet
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic