Solved

submit from a text link - with a twist

Posted on 2008-06-11
4
157 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
ID: 21759772
Hi,

try

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

Expert Comment

by:JohnSixkiller
ID: 21759839
Another solution:

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

Author Closing Comment

by:healthstatus
ID: 31466140
Thanks John!
0
 
LVL 11

Expert Comment

by:JohnSixkiller
ID: 21766584
You are welcome.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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 …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

863 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

19 Experts available now in Live!

Get 1:1 Help Now