箭头键被vtype mask extjs

时间:2018-12-20 12:53:14

标签: regex validation extjs arrow-keys

我正在使用extjs进行编程,并且正在为vtype mask和箭头键的干扰而苦苦挣扎。 我正在使用自定义vtypes验证某些字段,例如:

Ext.define('ldb.util.IbanVtype', {
    override: 'Ext.form.field.VTypes',

    // vtype validation function
    vTypeIban: function(value) {
        return this.vTypeIbanRe.test(value);
    },
    // RegExp for the value to be tested against within the validation function
    vTypeIbanRe: /^[A-Z]{2}[0-9]{2}[0-9]{2,30}$/,
    // vtype Text property: The error text to display when the validation function returns false
    vTypeIbanText: 'No valid IBAN',
    // vtype Mask property: The keystroke filter mask
    vTypeIbanMask: /[A-Z0-9]/i
});

验证IBAN字段。该字段位于网格的一列中,具有以下编辑器:

editor: {
    xtype: 'textfield',
    allowBlank: false,
    vtype: 'vTypeIban',
}

验证工作正常,但是在所有已验证的字段中,您无法使用箭头键在字符串中导航。

要启用它们,我必须在每个蒙版中添加%&':

vTypeIbanMask: /[A-Z0-9%&']/i

有人知道我如何启用箭头键而不允许我的面具中没有多余的字符吗? 我不知道为什么蒙版与箭头键交互。有人知道什么或对我有暗示吗?

非常感谢, 问候 操作系统

0 个答案:

没有答案