2016-12-20 9 views
1

"editor"フィールドにカスタムバリデータがあります。私はこのフィールドが有効であるかどうかをチェックし、フィールドが互いに同等かどうかをチェックしたい。しかし、私がバリデーターにthis.confirmationEditor.isValid()を追加すると、 "Uncaught RangeError:最大呼び出しスタックサイズを超えました"というエラーが表示されます。ExtJs 4.2.4 isValidカスタムバリデータ:Uncaught RangeError:最大呼び出しスタックサイズを超えました

Ext.define('My.view.common.MyPanelBase', { 
    extend: 'Ext.Panel', 

    constructor: function (config) { 
     if (config) { 
      Ext.applyIf(config.editorConfig, {allowBlank: false, 
     maskRe: /[0-9]/, 
     regex: /^[0-9]+$/, 
     enforceMaxLength: true, 
     maxLength: 6, 
     anchor: '95%', 
     inputType: 'password'}); 
     } 
     Ext.apply(this.config, config); 
     this.initializeEditors(); 
     this.initConfig(); 
    }, 

    initializeEditors: function() { 
     this.editor = Ext.create('Ext.My.TextField', Ext.apply(this.config.editorConfig, { 
      validator: this.editorValidator.bind(this), 
      fieldLabel: this.config.editorLabel 
     })); 
     this.confirmationEditor = Ext.create('Ext.My.TextField', Ext.apply(this.config.editorConfig, { 
      validator: this.confirmationEditorValidator.bind(this), 
      fieldLabel: this.config.confirmationEditorLabel 
     })); 
    }, 

    confirmationEditorValidator: function() { 
     //here I get the error 
     return this.confirmationEditor.isValid() && this.compareFields(); 
    }, 

    compareFields: function() { 
     return //some logic 
    } 
}); 

答えて

0

あなたはただ無限this.confirmationEditor.isValid()であなたのconfirmationEditorためconfirmationEditorValidator関数を呼び出します。 isValid()

内呼ば

validator設定Ext.form.field.Text

A custom validation function to be called during field validation (getErrors).

getErrors()方法

関連する問題