Hi Rick,
You aren't using multiple forms, are you? If you are, you're going to
run into problems with multiple elements having the same id -- with
the way this appears to be set up now.
Anyway, I think this could be a little simpler. Assuming a single
form, maybe something like this:
$(document).ready(function(event) {
event.preventDefault();
$('a.formlink').click(function() {
$('#supporttype').val(this.id);
$('#supportform').submit();
});
});
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On May 1, 2008, at 12:55 PM, Carl Von Stetten wrote:
Rick,
Try this (untested):
$(document).ready(function() {
$.each(".formlink"), function() {
$(this).click(function() {
$("#supporttype").val($(this).attr("id");
$("#supportform").submit();
});
});
});
<form id="supportform" name="supportform" method="post"
action="yourscriptname.cgi">
<input type="hidden" id="supporttype" name="supporttype" />
<a class="formlink" id="Paid">Paid Support</a> or
<a class="formlink" id="Free">Free Support</a>
HTH,
Carl
Rick Faircloth wrote:
As a follow-up to my question, I found this method
that utilizes regular JS, but I'd like to be able to
cause any link with a certain id to act as a "Submit Link".
Here's the code I found to create a text submit link:
<script language="JavaScript" type="text/javascript">
<!--
function getsupport ( selectedtype )
{
document.supportform.supporttype.value = selectedtype ;
document.supportform.submit() ;
}
-->
</script>
<form name="supportform" method="post" action="yourscriptname.cgi">
<input type="hidden" name="supporttype" />
<a href="javascript:getsupport('Paid')">Paid Support</a> or
<a href="javascript:getsupport('Free')">Free Support</a>
Thanks for any help in changing this to jQuery!
Rick
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-
[EMAIL PROTECTED] On Behalf Of Rick Faircloth
Sent: Thursday, May 01, 2008 12:08 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Way to designate links as form submitters?
Anyway to do that?
Have certain links, say with an id of "link",
to be programmed to submit a form when clicked?
Rick