Solved

submit from a text link - with a twist

Posted on 2008-06-11
4
156 Views
Last Modified: 2013-12-25
I have a form and due to client demands they want to be able to click a text link to submit the form.  So the link looks like this: <a href="#" onclick="document.theForm.submit()">Click here to view</a>

the problems are, a) this is a cgi page, b) there is a <base> tag defined<base href="mydomain.com">. So clicking the link, actually takes me to mydomain.com/# instead of just leaving me at my current location.  Putting in the full path to the page in the href causes me to lose my form data.

Can anybody help me resolve this?
0
Comment
Question by:healthstatus
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
JohnSixkiller earned 500 total points
Comment Utility
Hi,

try

<a href="javascript:void(0)" onclick="document.theForm.submit()">Click here to view</a>
0
 
LVL 11

Expert Comment

by:JohnSixkiller
Comment Utility
Another solution:

<a href="#" onclick="document.theForm.submit(); return false;">Click here to view</a>
0
 
LVL 2

Author Closing Comment

by:healthstatus
Comment Utility
Thanks John!
0
 
LVL 11

Expert Comment

by:JohnSixkiller
Comment Utility
You are welcome.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now