File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submitting form when 'enter' is hit

 
Anthony Leroy
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I stop the form from submitting when enter is hit?
OR how do I call a javascript function when enter is hit in a form field?
 
Dave Vick
Ranch Hand
Posts: 3244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anthony
To call a javascript function use this in your form tag:
<form name='myForm' onsubmit='return jsFunction();'>
Then have your function return true or false if its ok or not ok to submit it. If you return false the form isn't submitted and you can display an alert box or something else to the user to fix whatever's wrong and try again.
hope that helps

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic