pnod
asked on
Using the anchor tag to submit a form
Is there a way to submit a form using the <A> tag?
What did you want to occur when you submit the form, e.g. send the contents of the form via email from a cgi or perl script, or mailto, just do something on the client (user's browser only), etc.
tec
tec
ASKER
I'd like to capture the contents of a textfield in a session variable for use later on.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In addition, you can also use the following code to actually submit the form. I just realized that this might be more specific to your question.
<script language="javascript">
<!--
function SubmitMe() {
document.myform.submit();
}
//-->
</script>
The anchor tag would then look like:
<a href="javascript:void(0)" onClick="SubmitMe()">Click Me</a>
tec
<script language="javascript">
<!--
function SubmitMe() {
document.myform.submit();
}
//-->
</script>
The anchor tag would then look like:
<a href="javascript:void(0)" onClick="SubmitMe()">Click
tec
I just realized an even simpler way to write the submit via a link, which would be what I would suggest using. This way you don't need an extraneous code.
<A HREF="javascript:void(0)" onClick="document.myform.s ubmit(); return false">
tec
<A HREF="javascript:void(0)" onClick="document.myform.s
tec
<script language=javascript>
letsubmit()
{
form1.submit
}
</script>
<form name="form1" method="POST" action="action.asp">
.......
</form>
<a href="javascript:letsubmit ()">submit </a>
letsubmit()
{
form1.submit
}
</script>
<form name="form1" method="POST" action="action.asp">
.......
</form>
<a href="javascript:letsubmit
ASKER
Thanks for the help. I really appreciate it.
There's a way to submit form *data*, but not the data filled out by someone, only form data pre-coded into the page.
You can submit a form with an image, which you can fake up to look like text, of course.