PDA

View Full Version : "form.submit is not a function" for a BasicForm?



DanielD
28 Nov 2007, 11:07 PM
Hello,

Sorry if this is a simple error, but I can't figure it out. Here is my form HTML:


<form action="form_submit.php" method="post" enctype="multipart/form-data" name="submitForm" id="submitForm">
<label for="title">Title:</label>
<input type="text" name="title" tabindex="1" id="title" /><br />
<label for="file">Picture:</label>
<input type="file" name="file" tabindex="2" id="file" style="margin-right: 6px" /><br />
<label for="comment">Comment:</label>
<input type="text" name="comment" tabindex="3" id="comment" size="50" /><br />
<label for="name">Name:</label>
<input type="text" name="name" tabindex="4" id="name" /><br />
<input type="submit" name="submit" value="submit" tabindex="5" id="submit" style="margin-top: 6px;" />
</form>In my application init method, all forms in the markup are grabbed using:


// enhance all forms
Ext.select('form').each(this.handleForms, this); For this function:



/*
* Function to handle and intercept all forms.
*/
handleForms : function(formEl) {
var basicForm = new Ext.form.BasicForm(formEl.dom.id, {
baseParams: { ajaxSubmit: 'true' },
fileUpload: true,
onSubmit:function(e) {
this.doAction('submit',{
success: function ( result, request) {

Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText); },
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', 'Successfully posted form: '+result.date);
}
});
e.stopEvent();
}
});
}
Yet when I submit, the Firebug console has the error "form.submit is not a function". I can step through with FireBug and see the basicForm gets initialized correctly. The call to "form.submit()" is on line 5296 of ext-all-debug.js inside the doFormUpload method. Thanks for the help.