Solved

submit from a text link - with a twist

Posted on 2008-06-11
4
158 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS: Making responsive table look nicer 7 27
Scroll 5 news at a time. 4 28
Little bit of help styling my heading 3 21
Can't get js include to work in html file 8 15
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

803 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