I have a hyperlink in my form, and I am using:
Expand|Select|Wrap|Line Numbers
- <a href="javascript:myFunction('myTextBox','myFormName','ServletName')"> Go </a>
In my Javascript code, if all goes well, the form gets submitted and the page is forwarded to a servlet. If not, it should just alert the user and cancel the navigation.
Expand|Select|Wrap|Line Numbers
- if ((Fld.value.length==0) || (Fld.value==null) {
- alert("Please Enter the information");
- return false;
- }
- else {
- //Submit form and go to servlet
- }
I have used the same code for a button and it works without problems. But since this is a hyperlink, instead of cancelling the navigation, I just get a Webpage with 'False' wirtten on top.
Is there a way to implement this with a hyperlink to work as appropriately as a button? I need to use hyperlinks according to design of some forms
Thank you for your help
Maral