aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes anyone can help with alert in jscript ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "anyone can help with alert in jscript ?" Watch "anyone can help with alert in jscript ?" New topic
Author

anyone can help with alert in jscript ?

svr
Greenhorn

Joined: Jan 06, 2004
Posts: 8
I have written a validation code in javascript. Gave an alert if the field is not valid. But after clicking the OK of the alert it submits the form. But in my case it shouldn't submit the form !.....please help me
Thanks for the help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

Ryan, thanks for changing your display name, but you didn't read the policy completely. Your display name must be a first and a last name separated by a space. Please try again.
With regards to your question, some code might help (please be sure to use UBB code tags to preserve formatting), but the most likely reason is that you are performing your validation in an onsumbit handler to your form (true or false?) which is not returning a value of false upon failure.
bear
[ January 06, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Basic idea
<form onsubmit="return Validate()">
fucntion Validate(){
if(error){
return false;
}
else{
return true
}
}
David Vickers
Greenhorn

Joined: Oct 02, 2003
Posts: 13
I agree with eric. I used the code below to check for empty fields. Also, it sends the user back to the offending piece too:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: anyone can help with alert in jscript ?