views:

292

answers:

5

hi guys

I am trying to submit a form by using jquery automatically after page load

$(function(){

$("input[name=name]").val("somename");
$("input[name=email]").val("[email protected]");
$('#aweberform').submit();

});

Both the name/email value can be seen to get populated on the form. But the submit event wont triggered.

Any one here that can shed any lights ?

thanks !

A: 

Syntax looks correct. Did you try to debug with Firebug?

Jason
Here's the thing, firebug console is totally blank. the name/email field got populated though.its kind of bizarre.
Rob Chuah
A: 

Are you sure your form's id="aweberform" ?

styts
Yeap. I purposely hacked the form to carry the id of aweberform
Rob Chuah
A: 

Have you got action and method set in the form ??

Shaun Hare
Neither is strictly necessary. The action will default to the same URL and the method will default to GET.
Patrick McElhaney
Patrick is right should not need to be set - post your html for more help
Shaun Hare
A: 

Add a function in the submit. Seems to work for me.

$('#aweberform').submit(function(){return true;});
Philip Schlump
+1  A: 

ok i found out the problem

apparently the submit input cannot have the name submit

<input type="submit" name="submit" value="click to submit!">

changed to

<input type="submit" name="someothername" value="click to submit!">

and that got the problem fixed

Rob Chuah