Click to search on your search term.
Subscribe to Fig Leaf Tutorials

Need help with a project? Contact us at
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:

Submitting Data to the Server

Page of 168

Post data to the server using the method as illustrated by the following code snippet:

 clientValidation: true,
 url: 'updateData.php',
 params: {
   urlVar1: 'some value'
 success: function(form, action) {
  Ext.Msg.alert('Success', action.result.msg);
 failure: function(form, action) {
  switch (action.failureType) {
    case Ext.form.action.Action.CLIENT_INVALID:
      Ext.Msg.alert('Failure', 'Form has invalid values');
    case Ext.form.action.Action.CONNECT_FAILURE:
      Ext.Msg.alert('Failure', 'Ajax communication failed');
    case Ext.form.action.Action.SERVER_INVALID:
      Ext.Msg.alert('Failure', action.result.msg);

By default, the form fields will be submitted to the url via an XMLHttpRequest(). Note that in order for the form submit action to be considered a success, it must receive JSON data from the server response that resembles the following:

{success: true, msg: 'Thank you for your input'}

Alternatively, you can pass back JSON that indicates a series of errors took place. Ext will automatically invalidate the related form fields and display the error messages.

   success: false,
   errors: [
       id: 'firstname',
       msg: 'Elvis is not a valid name'
Page of 168
comments powered by Disqus