?
Solved

use link as submit button

Posted on 2011-05-11
5
Medium Priority
?
278 Views
Last Modified: 2012-08-13
Hello!

Does anyone know if I can use a normal href hyperlink to submit a form. I've looked around at the forum, and I can't seem to see a simple answer...or anyone who has asked the question without also needing to do something else complex. I just need to have the form submit some data to a php process page. But I do not want a button. Just a link!

Thank you in advance!
0
Comment
Question by:hibbsusan
5 Comments
 
LVL 7

Accepted Solution

by:
JosephEricDavis earned 1000 total points
ID: 35739854
http://www.javascript-coder.com/files/form-submit/javascript-form-submit-example.html

You can tie a link into javascript like this...

<a href="javascript:submitform()">your link</a>
0
 
LVL 7

Expert Comment

by:JosephEricDavis
ID: 35739859
The link provided shows how to submit a form with javascript.
0
 
LVL 23

Expert Comment

by:cmalakar
ID: 35739876

<form action="http://www.google.com">
  <a href="javascript:document.forms[0].submit()"> submit Form</a>
</form>

Open in new window

0
 
LVL 13

Expert Comment

by:ansudhindra
ID: 35739905
may be u can do like this.

<form name="test">
..........
<a href="#" onclick="javascript:return doSubmit()">Submit Form</a>
</form>
<script type="text/javascript">
   fucntion doSubmit(){
        //do validations if needed.
        document.test.action="actionpage.php";
        document.test.submit();
        return true;
}
</script>
0
 

Author Closing Comment

by:hibbsusan
ID: 35744415
Really quick answer. It couldn't have worked more perfectly.

Thank you so much!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

609 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