0
我以下在EXTJS教程中,我有這個視圖(YourTurn.js)如何驗證Extjs6中的文本?以及在哪裏添加代碼?
Ext.define('Student.view.main.YourTurn', {
extend: 'Ext.window.Window',
xtype: 'mainyour',
requires: [
'Student.view.main.YourTurnController',
'Ext.form.Panel'
],
autoShow: true,
height: 170,
width: 360,
layout: {
type: 'fit'
},
iconCls: 'key',
title: "Login",
closeAction: 'hide',
closable: false,
items: [{
xtype: 'form',
frame: false,
bodyPadding: 15,
defaults: {
xtype: 'textfield',
anchor: '100%',
labelWidth: 60
},
items: [{
name: 'user',
fieldLabel: "User",
allowBlank:false,
vtype:'alphanum',
minLenght:3,
msgTarget:'under',
}, {
inputType: 'password',
name: 'password',
fieldLabel: "Password",
maxLength:15,
allowBlank:false,
vtype:'alphanum',
minLenght:3,
msgTarget:'under',
}]
}]
});
,我有這種觀點的這樣的控制器(YourTurnController.JS):
Ext.define('Student.view.main.YourTurnController', {
extend: 'Ext.app.ViewController',
alias: 'controller.yourturncontroller',
Ext.apply(Ext.form.field.VTypes, {
customPass: function(val, field) {
return /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})/.
test(val);
},
customPassText: 'Not a valid password. Length must be at least
6 characters and maximum of 20 Password must contain one digit,
one
letter lowercase,
one letter uppercase,
onse special symbol @ # $ % and
between 6 and 20 characters.
',
});
及其應驗證該vlaue進入到文本框應該是0-9之間,具有體積小,資金letter..etc,但它沒有工作,我得到在布勞爾這個錯誤(鉻):
YourTurnController.js?_dc=1477341018794:5 Uncaught SyntaxError: Unexpected token .
ext-all-rtl-debug.js?_dc=1477341016439:9126 [E] [Loader] The following classes failed to load:log @ ext-all-rtl-debug.js?_dc=1477341016439:9126logx @ ext-all-rtl-debug.js?_dc=1477341016439:9162Ext.apply.log.log.error @ ext-all-rtl-debug.js?_dc=1477341016439:9165(anonymous function) @ ext-all-rtl-debug.js?_
請任何人都可以幫我解釋我做錯了什麼?
你可以添加一個小提琴? –