Now, we have quite a mess of a form with only one problem it doesn't send data to the server, which was the actual point behind creating our form in the first place. To do, this we are going to add some buttons.
Our buttons are added to a buttons
config object, similar to the way that the form fields were added. These buttons really only need two things: the text to be displayed on the button, and the function(which is called the handler) to execute when the button is clicked.
buttons: [{ text: 'Save', handler: function(){ movie_form.getForm().submit({ success: function(f,a){ Ext.Msg.alert('Success', 'It worked'); }, failure: function(f,a){ Ext.Msg.alert('Warning', 'Error'); } }); } }, { text: 'Reset', handler: function(){ movie_form.getForm().reset(); } }]
The handler is provided with a function—or a reference to a function—that will be executed once the button is clicked. In this case...