tags:

views:

37

answers:

3
function FormSubmit(formid) {

this.initialize = function(formid) {
 this.formid = formid;
 $(formid).observe('submit', this.send);
}


this.send = function() {
 alert('sending '+this.formid)
 this.formid.onSubmit = true;
}

this.initialize(formid); 
} 

var form = new FormSubmit('donate_form');


<form method="post" 
action="https://mysite.com/form_submit" 
onsubmit="return false;" id="donate_form">

How can I make the above code, submit the form? The event works, but the form doesn't submit.

Thanks Rich

+2  A: 

change

this.formid.onSubmit = true;

to

this.formid.submit();

Update

Whoops...forgot to double check the Javascript framework you were using. It looks like you're using Prototype. Please correct me if I'm wrong. In that case, instead of

this.formid.onSubmit = true;

you could try just

return true;
Justin Niessner
+1  A: 

use document.forms[0].submit();

tommaso
+1  A: 

Also:

document.getElementById('donate_form').submit();
Mike King