Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there way for a link not to submit. 2

Status
Not open for further replies.

Weese

Programmer
Apr 3, 2003
17
<FORM method=&quot;post&quot; name=&quot;MyScreen&quot; onsubmit=&quot;return false&quot; action=&quot;Myasp.ASP?WCI=MyScreen&amp;WCE=MyEvent&quot;>

<A link href=&quot; &quot; onClick=SubmitForm()>Option</A>

See in the above case, I am explictly using submit in SubmitForm function.

But in browsers like mozilla, before the page unload javascript file expires and at the moment if the users click this link, getting error in the javascript console SubmitForm not defined, but still the page gets submitted agian.this should not happen.It should submit only through SubmitForm and if not found nothing should happen.How to do?.
href=&quot; &quot; is required for hand reference.

Please someone guide in this.
 
try this:

<A link href=&quot;#&quot; onClick=&quot;SubmitForm();return false;&quot;>Option</A>

=========================================================
while (!succeed) try();
-jeff
 
Thank you Jemminger,

This really solves my problem.
I had a plan of using href=&quot;javascript:void(0)&quot;.But this creates another problem that it displays in status bar.I tried to overcome this by onMouseOver=&quot;self.status='';&quot;.But even though if we tab through the link still it appears in the status bar. But your solution really solves my problem.

thank you very much.
 
Weese,

Try this code :

<a
href=&quot;noJSPage.html&quot;
overMsg=&quot;Submit Form&quot;
onmouseover=&quot;window.status=this.overMsg&quot;
onfocus=&quot;window.status=this.overMsg&quot;
onmouseout=&quot;window.status=window.defaultStatus&quot;
onblur=&quot;window.status=window.defaultStatus&quot;>
Submit this form
</a>

Might seem like overkill but it should work! :) Gary Haran
==========================
 
Gary,

you need to add &quot;return true&quot; for it to work correctly:

<a
href=&quot;noJSPage.html&quot;
overMsg=&quot;Submit Form&quot;
onmouseover=&quot;window.status=this.overMsg; return true;&quot;
onfocus=&quot;window.status=this.overMsg; return true;&quot;
onmouseout=&quot;window.status=window.defaultStatus; return true;&quot;
onblur=&quot;window.status=window.defaultStatus; return true;&quot;>
Submit this form
</a>
=========================================================
while (!succeed) try();
-jeff
 
Hi Gary & jeff,
Thank u all for ur valuable guidance.It really helps me a lot.
 
Is there a way like disabling a link to prevent a user click multiple times on a link and the page get submitted multiple times.

What I want is once the user clicks over the link, he should not be able to reclick.But the hyperlink should be there giving the feeling that it is a link.

User should not knows it get disabled or some thing else.

My total aim to prevent the user for clicking multiple times.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top