1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    159
    Vote Rating
    0
    dizor is on a distinguished road

      0  

    Default Submit failure override

    Submit failure override


    How i can override standard form submit function?
    I want have one failure handling funciton.

    Code:
    this.form.getForm().submit({
         url: 'test',
         success: function () {
         
         }
    });
    
    Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
    	failure: function () {
    	}
    });
    ... doesn't work.

  2. #2
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    witch kind error can handler your failure submit method ?

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    159
    Vote Rating
    0
    dizor is on a distinguished road

      0  

    Default


    I want have one default "failure" for all "submit".

  4. #4
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    For me if I need to know if my form is on defaut before submit, I use myForm.isValid() and intercept failure after submit is mangaged by ajax component... I don't understand what do you need exactly, sorry !

  5. #5
    Sencha User
    Join Date
    Nov 2008
    Posts
    159
    Vote Rating
    0
    dizor is on a distinguished road

      0  

    Default


    I want override standard failure function - so i do not have to enter it every time.

  6. #6
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    ok... so try this

    Code:
    Ext.override(Ext.form.BasicForm, {
      initComponent: function () {
        Ext.form.BasicForm.superclass.initComponent.call(this);
        this.on('actionfailed', function (action) {
          // make what you need
        }, this);
      },
    ps: they are not failure function for Submit action, failure are manage on succes method... failure is about http failure

    look source code
    Code:
        // private
        success : function(response){
            var result = this.processResponse(response);
            if(result === true || result.success){
                this.form.afterAction(this, true);
                return;
            }
            if(result.errors){
                this.form.markInvalid(result.errors);
            }
            this.failureType = Ext.form.Action.SERVER_INVALID;
            this.form.afterAction(this, false);
        },

Similar Threads

  1. Submit always failure help!!!
    By ratatuia in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 23 Nov 2011, 1:17 AM
  2. failure on form submit
    By rishi89 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 7 Jul 2010, 9:26 PM
  3. Action.Submit() returning failure
    By dVyper in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 26 Nov 2008, 3:47 AM
  4. override Ajax failure handler globally
    By wisecounselor in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 4 Dec 2007, 3:55 PM
  5. submit failure
    By m0d in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 19 Nov 2007, 4:17 AM

Thread Participants: 1