View Full Version : [FIXED]'submit' Button doesn't submit without null clickEvent

3 Mar 2011, 10:27 AM
With a new Ext.button.Button of type 'submit', the clickEvent has to be set to null in order for the button to submit the form.

This is because Button.onClick prevents the event from bubbling up if an onclick event handler exists.

It seems that if the Button's type is submit, it shouldn't prevent the event from propagating.

And while I'm here...
+1 on API docs using the TabPanel (as with previous versions).

Great work on Ext4 so far. Looking forward to the next update.

5 Mar 2011, 12:19 PM
You need a handler which submits the form.

preventDefault is needed to stop the old fashioned, non-Ajax DOM submission happening so that you can do a proper web 2.0 data submit.

The type: "submit" just means that it activates when the user presses Enter.

6 Mar 2011, 11:18 PM
Then what's the recommended way to do a "web 1.0" submit using an Ext button? There are autocomplete issues on IE when submitting the form using the click handler. It seems like being able to disable the click handler explicitly is more intuitive than setting the clickEvent to some non-existant event name or null.

7 Mar 2011, 1:06 AM
Just to confirm.. you actually want to throw your whole page and all the expensively loaded Javascript away when you submit your form, and receive a whole new page in response?

7 Mar 2011, 4:26 AM
I've added a new preventDefault option, which defaults to true.

7 Mar 2011, 7:49 AM
That works for us, thank you. I'm guessing we aren't the only ones who have to do an old-school submit every now and then (such as login pages).

8 Mar 2011, 3:01 PM
I'm not sure this is quite what you need. I can see how it would work if there were actually a form element wrapping the fields, but that is no longer the case in Ext4. So even if preventDefault is false, there is no form to be submitted without a handler to perform the submit.

If you need a standard form submit, I think what you want is the 'standardSubmit' option: http://docs.sencha.com/new/ext-js/4-0/api/Ext.form.Basic#standardSubmit -- that will build a standard form in the background and submit it, when the Basic form's submit method is invoked.

8 Mar 2011, 3:10 PM
The button is inside a form that we created.
We wanted an Ext button for numerous reasons, but need it to submit the form.
While we wait for the next version with evant's preventDefault addition, we are setting the clickEvent to null, so that the form gets submitted when the button is clicked.

So all is well now.

8 Mar 2011, 3:11 PM
Ah, I see. Good to know you're all set. :)