Im finding that because all the forms that Im working on have a submit button which inlcudes a 'name="submit"' attribute, that the trigger submit is breaking when I click on the link that is supposed to trigger the form submit.
Does anyone know how I can get round this.
The JQuery code below is what Im using:
$('#login_form :submit').each(
function()
{
var $this = $(this);
var f = this.form;
var link = $('<a class="swap_link" href="#">' + $this.val() + '</a>')
link.click(function()
{
$(f).trigger('submit');
return false;
}
)
$this.after(link).css({position:'absolute', top:'-2000px'});
}
)
Appreciate any help with this. Thanks
Hi. check out the link below:
http://www.mr-scraggy.com/test.html
on this page you can see the form in action. The top form which does not have a name="submit" in the submit button works. The bottom form which includes the name="submit" does not. (when I say work, the form is not hooked up to any scripts, but you can see that the submit link in the top form does 'something').
see also below the form html:
<form id="swaplink" name="login" action="/action/login.php" method="post" accept-charset="utf-8" class="clearfix">
<input type="hidden" name="redirecturl" id="redirecturl" value="{$redirecturl}" />
<h2>My Account Login</h2>
<ul id="login_form">
<li>
<label for="username">Username:</label>
<input type="text" name="username" id="username" class="input-text" maxlength="32" />
</li>
<li>
<label for="password">Password:</label>
<input type="password" name="password" id="password" class="input-text" maxlength="32" />
</li>
<li>
<input type="submit" name="submit" value="Login" />
</li>
</ul>
{$failed_message}
</form>