Results 1 to 4 of 4

Thread: form.submit returns success, but fails?

  1. #1
    Sencha User
    Join Date
    Jun 2007
    Posts
    266

    Default form.submit returns success, but fails?

    When I save a form, it execute php code, and returns simple JSON that says

    But it hits the failure function instead? What am I missing?

    Code:
                       Ext.getCmp('user-details-form').getForm().submit({
                    	   params: { save: 'user' },
                    	   waitMsg: 'Saving...',
                    	   success: function(f,a){ 
                    		   Ext.Msg.alert('User Saved');
                    	   },
                    	   failure: function(f,a){
                    		   Ext.Msg.alert('Error Saving User');
                    	   }
                       });
    Relevant section of php code
    PHP Code:
    $response = array("success"=>true);
                return 
    json_encode($response);
              } catch(
    Exception $e)
            {
                
    $response = array("success"=>false,
                                  
    "message"=>$e->getMessage());
                return 
    json_encode($response);
            } 
    Firebug shows this returned, but the alert pop up says the "Error saving user" message from the failure function
    {success:true}

    I have setup a function that both success or failure call, and it just checks to see if the value returned is true or false and does the pop ups based on that, but I figured I should find out why it's always showing fail when it comes back. Breaking in firebug shows a.result.success = true; a.result being an object.

    What have I missed?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Is it a file upload?

  3. #3
    Sencha User
    Join Date
    Jun 2007
    Posts
    266

    Default

    no it's a regular form submit, posting of data.

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You will have to set a breakpoint in Ext.form.Action.Submit where it processes the response and step through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •