This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript that can stop processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript that can stop processing" Watch "JavaScript that can stop processing" New topic

JavaScript that can stop processing

ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
I have a webapp running in Apache and Tomcat using JSPs, Servlets, and Java Beans. I also use some javascript to do some error checking before submit is clicked.
What I need to do is if there is an error in the form upon either clicking save, hitting enter, or tabbing out, popup an alert telling them there is an issue.
However, even when the click submit, the error pops up but the submit process still takes place. Is there a way to get that to stop??

Ryan Headley<br /><a href="" target="_blank" rel="nofollow"></a>
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
Nevermind, I got it to work.
I needed to do this: (this is general code not my code exactly)

Then in my code, if the test failed the function had to return false, else it returned true.
Problem solved...
Have you checked out Aspose?
subject: JavaScript that can stop processing
It's not a secret anymore!