473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cancelling the hyperlink navigation

14 New Member
Hi

I have a hyperlink in my form, and I am using:

Expand|Select|Wrap|Line Numbers
  1. <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
  1. if ((Fld.value.length==0) || (Fld.value==null) {
  2.         alert("Please Enter the information");
  3.         return false;  
  4.     }
  5.     else {
  6.  
  7.         //Submit form and go to servlet
  8.  
  9.     }

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
Feb 28 '08 #1
2 2026
hsriat
1,654 Recognized Expert Top Contributor
Try this..[html]<a href="javascript:myFunction('myTextBox','myFormNam e','ServletName')" onclick="return validate()"> Go </a>[/html]If validation is done in myfunction(), then try to make a separate validate() function.
Feb 28 '08 #2
maralfarshadi
14 New Member
Try this..[html]<a href="javascript:myFunction('myTextBox','myFormNam e','ServletName')" onclick="return validate()"> Go </a>[/html]If validation is done in myfunction(), then try to make a separate validate() function.
Thank you very much for suggesting that.
Feb 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4856
by: Randell D. | last post by:
Folks, I am working on a contact db using PHP and MySQL. My results so far outputs a slimed down version of records to the browser. I would like to implement a method whereby the user can...
0
1453
by: TheMan | last post by:
I am having trouble getting my HyperLink control to go to the desired navigation page. I have an image control on an ASP.NET page. When that image control is clicked it creates a HyperLink control...
3
10925
by: Sandy Bremmer | last post by:
I was curious how one goes about properly creates a table row with multiple TD cells as a single hyperlink because I have seen examples of what I think is invalid and poorly conceived HTML. It...
4
4833
by: clintonG | last post by:
Any folklore regarding the benefits of using one or the other of these controls? <%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT...
0
1273
by: Nathan Sokalski | last post by:
Whenever I assign a value to the HyperLink.NavigateUrl property, it adds an extra ../ in the generated href= attribute of the anchor tag. For example, when I assign it the value "comments.aspx" the...
3
12342
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database?...
3
2169
by: breakupemail | last post by:
Hello, on my website at http://www.breakupemail.com/ there is a horizontal navigation bar with 6 hyperlinks. Recently, I added a second navigation row below the first, with 2 links. Once this...
1
1601
by: John Devlon | last post by:
Hi, I have a problem using a hyperlink and a frameset... When I run the application, and click on the link, the link is displayed in a new window... But the strange thing is, I set the target...
2
4671
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi, I am creating emails dynamically using C# and would like to place a hyperlink in the email body before sending it out. I added the text for what I thought was a hyperlink but the email just...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.