PDA

View Full Version : Do Forms have to be AJAX?



parsifal
21 Jun 2007, 8:05 PM
Hi,

I'm using Ext.form.Form, and I like it, but does it have to be Ajax? I want to just have it submit like a regular form, and take the user to a new page. How can I do that?

Thanks,
Sean

Animal
22 Jun 2007, 12:24 AM
It's just a wrapper for a regular DOM form to which it attaches a listener to hijack the submit event.

You can undo that:



myForm.el.un("submit", myForm.onSubmit);


And you should be able to submit as normal.

parsifal
22 Jun 2007, 5:25 AM
No, that doesn't work.

Accessing form.el before the call to .render() is a null reference, and doing form.el.un("submit", form.onSubmit) after the call to .render() does not result in the form being submitted when I click on a button.

Thank you for helping, though :-)

evant
22 Jun 2007, 5:28 AM
You might also have to hook up the button yourself, eg:



Ext.get('someButton').on('click', function()
{
Ext.getDom('someForm').submit();
}
);

Animal
22 Jun 2007, 7:22 AM
You'll need to unhook that listener. The principle that I gave you is correct. You need to call un("submit"...) to remove the form's own submit handler which stops the event.

You have to do this.

Animal
22 Jun 2007, 7:25 AM
It might have to be



myForm.el.un("submit", myForm.onSubmit, myForm);