- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用其中包含文件上传字段的 ExtJs 表单。在选择一个文件时,我调用了表单的 submit() 方法。但在提交之前,我使用 form.isValid()
检查表单是否有效。现在由于一些未知原因,我将 form.isValid() 设置为 FALSE
。
但我想知道为什么表单验证失败?我将所有其他字段保留为 allowBlank: false
。
有没有办法知道(使用方法或配置属性)表单验证失败的原因以及表单中的无效字段(以及消息)是什么?
这是我的代码:
var simple = Ext.create('Ext.form.Panel', {
id : 'textIntConfigPanel',
frame : true,
bodyPadding : 1,
width : '100%',
layout : 'anchor',
fileUpload: true,
items :[{
xtype : 'panel',
layout : 'column',
fieldDefaults : {
labelAlign : 'center',
msgTarget : 'side'
},
items : [{
xtype: 'fieldset',
columnWidth:0.5,
border: false,
items:[{
xtype : 'fieldset',
title: 'Configuration',
flex : 1,
defaultType : 'textfield',
items : [{
xtype : 'radiogroup',
fieldLabel : 'Configuration',
id:'rdType',
columns : 2,
defaults : {
name : 'rdType'
},
items : [{
inputValue : '0',
boxLabel : 'Existing',
checked : true
},{
inputValue : '1',
boxLabel : 'New'
}]
},{
xtype: 'container',
layout: 'hbox',
padding: '0 5 0 0',
items: [{
xtype: 'textfield',
fieldLabel : 'Configuration Name',
name : 'txtConfigName',
id:'txtConfigName',
padding: '0 5 0 0',
hidden:true,
disabled:true
},{
xtype : 'image',
padding: '0 5 0 0',
hidden:true,
id:'nameConfirmation'
}]
},{
name : 'txtOldConfigTable',
id:'txtOldConfigTable',
hidden:true
},{
xtype : 'combobox',
fieldLabel : 'Configuration Name',
name : 'cmbConfigName',
id:'cmbConfigName',
editable:false,
valueField : 'configId',
displayField : 'configName',
emptyText : 'Select Configuration...',
store : configNameStore
},{
xtype : 'radiogroup',
fieldLabel : 'If Data Exists',
id:'ifExists',
columns : 2,
defaults : {
name : 'ifExists'
},
items : [{
inputValue : 0,
boxLabel : 'Update & Insert',
checked : true
},{
inputValue : 1,
boxLabel : 'Insert Only New'
}]
},{
xtype : 'radiogroup',
fieldLabel : 'Location',
id:'rdoLoc',
columns : 3,
defaults : {
name : 'rdoLoc'
},
items : [{
inputValue : '0',
boxLabel : 'Local',
checked : true
},{
inputValue : '1',
boxLabel : 'HTTP'
},{
inputValue : '2',
boxLabel : 'FTP'
}]
},{
fieldLabel : 'File Location',
name : 'txtFileLoc',
disabled:true,
hidden:true,
id:'txtFileLoc'
},{
fieldLabel : 'User Name',
name : 'txtUserName',
disabled:true,
hidden:true,
id:'txtUserName'
},{
fieldLabel : 'Password',
name : 'txtPassword',
inputType :'password',
disabled:true,
hidden:true,
id:'txtPassword'
}]
},{
xtype : 'fieldset',
title: 'Scheduling',
flex : 1,
defaultType : 'textfield',
layout : 'vbox',
items:[{
xtype : 'fieldset',
flex : 1,
border:false,
padding :0,
margin:0,
defaultType : 'textfield',
width : '100%',
layout : 'hbox',
items:[{
xtype : 'fieldset',
flex : 1,
border:false,
padding :0,
margin:0,
defaultType : 'textfield',
width : 50,
layout : 'anchor',
items:[{
xtype : 'combobox',
fieldLabel : 'Repeat Type',
name : 'cmbRptType',
id:'cmbRptType',
editable:false,
labelWidth : 90,
width : 180,
store:[['0','Never'],['1','Hourly'],['2','Daily'],['1','Monthly']],
displayField: 'val',
valueField: 'key',
emptyText : 'Select RepeatType...'
},{
xtype : 'textfield',
fieldLabel : 'Repeat Interval',
name : 'txtRptInc',
labelWidth : 90,
width : 150,
id:'txtRptInc',
regex: /^[1]?[0-9]{0,1}$/,
regexText: "<b>Error</b></br>Increment Must be Integer"
}]
},{
xtype : 'fieldset',
border:false,
padding :'0 0 8 0',
margin:0,
flex : 1,
defaultType : 'textfield',
width : 20,
layout : 'anchor',
defaults : {
anchor : '100%',
hideEmptyLabel : false
},
items:[Ext.create('Ext.ux.form.DateTimeField', {
xtype : 'textfield',
name : 'exeStartDateTime',
id : 'exeDateTime',
labelWidth : 100,
width : 35,
fieldLabel : 'Start Date Time'
})
,Ext.create('Ext.ux.form.DateTimeField', {
xtype : 'textfield',
name : 'exeEndDateTime',
id : 'exeEndDateTime',
labelWidth : 100,
width : 35,
fieldLabel : 'End Date Time'
})]
}]
}]
}]
},{
xtype : 'fieldset',
title: 'Data Preparation',
flex : 1,
defaultType : 'textfield',
columnWidth: 0.5,
width : '100%',
layout : 'vbox',
items:[{
xtype : 'fieldset',
flex : 1,
border:false,
padding :0,
margin:0,
defaultType : 'textfield',
width : '100%',
layout : 'hbox',
items:[{
xtype : 'fieldset',
flex : 1,
border:false,
padding :0,
margin:0,
defaultType : 'textfield',
layout : 'anchor',
items:[{
fieldLabel : 'File Name Pattern',
name : 'txtfileNamePatern',
id:'txtfileNamePatern',
value: '*.*'
},{
xtype: 'container',
layout: 'hbox',
items: [{
xtype: 'filefield',
name : 'fileUploadBox',
id:'fileUpload',
vtype : 'file',
width: 250,
fieldLabel : 'Upload File',
buttonText: 'Browse',
listeners : {
change : function(s, v, o) {
fileName = v;
var form = this.up('form');
debugger;
form.submit({
url : 'textFileIntegrationConfig_!readFile?fileName=' + fileName,
data : {
fileName : fileName
},
success : function(fp, o) {
debugger;
var response = JSON.parse(o.response.responseText);
},
failure : function(fp, o) {
debugger;
var response = JSON.parse(o.response.responseText);
}
});
}
}
},{
xtype : 'image',
hidden:true,
id:'uploadConfirmation'
}]
}]
},{
xtype : 'fieldset',
border:false,
padding :'0 0 8 0',
margin:0,
flex : 1,
defaultType : 'textfield',
width : 300,
layout : 'anchor',
defaults : {
anchor : '100%',
hideEmptyLabel : false
},
items:[{
xtype: 'container',
layout: 'hbox',
items: [{
xtype : 'combobox',
fieldLabel : 'Data Delimiter',
name : 'cmbFieldDelim',
id:'cmbFieldDelim',
margin: '5 5 5 0',
editable:false,
width: 200,
store:[["\\t",'Tab'],["\\n",'New Line'],['99','Other']],
displayField: 'val',
valueField: 'key'
},{
xtype: 'textfield',
name : 'txtFieldDelim',
id : 'txtFieldDelim',
enforceMaxLength: false,
hidden: true,
margin: '5 0 0 0',
maxLength: 2,
width: 50,
validateOnChange : true,
validator: function(v) {
var txtFieldDelim = Ext.ComponentQuery.query("textfield[name='txtRecordDelim']")[0];
if (v == txtFieldDelim.value) {
return "Both Delimiter can't be same";
}
return true;
}
}]
},{
xtype: 'container',
layout: 'hbox',
items: [{
xtype : 'combobox',
fieldLabel : 'Row Delimiter',
name : 'cmbRecordDelim',
id:'cmbRecordDelim',
editable:false,
margin: '0 5 5 0',
width: 200,
store:[['\\r','Tab'],['\\n','New Line'],['99','Other']],
displayField: 'val',
valueField: 'key'
},{
xtype: 'textfield',
name : 'txtRecordDelim',
id : 'txtRecordDelim',
enforceMaxLength: false,
hidden: true,
maxLength: 2,
width: 50,
validateOnChange : true,
validator: function(v) {
var txtFieldDelim=Ext.ComponentQuery.query("textfield[name='txtFieldDelim']")[0];
if(v==txtFieldDelim.value){
return "Both Delimiter can't be same";
}
return true;
}
}]
}]
}]
},{
xtype : 'gridpanel',
flex : 1,
autoSync:false,
autoScroll:true,
id: 'configGrid',
width : '100%',
height:180,
columns: [{
xtype: 'gridcolumn',
flex: 0.33,
text: 'File Header Name',
sortable: false,
menuDisabled: true,
dataIndex: 'header'
},{
text: 'Field Type',
flex: 0.33,
menuDisabled: true,
dataIndex: 'dataType'
},{
text: 'Table Field Name',
flex: 0.33,
menuDisabled: true,
dataIndex: 'finalFieldName',
editor: 'textfield'
}],
store : gridStore,
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})]
}]
}],
tbar: ['->', {
text : 'Save',
icon: "images/icon-save.gif",
handler : function() {
var form=this.up('form');
formAllowBlank(false);
if (form.getForm().isValid()) {
Ext.MessageBox.show({
msg : 'Saving data, please wait...',
progressText : 'Saving...',
width : 300,
wait : true,
waitConfig : {
interval : 200
}
});
saveData(form);
}
}
},{
text : 'Test & Run Now',
id: 'Integration.TestBtn',
icon: "images/run.png",
handler : function() {
var form=this.up('form');
TestData(form);
}
}, {
text : 'Reset',
icon: "images/cross.png",
handler : function() {
resetData();
}
} ]
}]
});
最佳答案
这里有一个更简单的解决方案:
form.query("field{isValid()==false}")
关于javascript - ExtJs:表单 isValid() 为假。但是如何知道表单无效的原因呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19354433/
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 9年前关闭。 Improve this que
我有一堆 php 脚本计划在 CentOS 机器上的 cron 中每隔几分钟运行一次。我希望每个脚本在启动时自我检查它的前一个实例是否仍在运行,如果是则停止。 最佳答案 我这样做是为了管理任务并确保它
是否有 bash 命令、程序或 libusb 函数(尽管我没有找到)来指示 USB 设备的 OUT 或 IN 端点是什么? 例如,libusb_interface_descriptor(来自 libu
我如何知道 NSTextField 何时成为第一响应者(即当用户单击它来激活它时,但在他们开始输入之前)。我尝试了 controlTextDidBeginEditing 但直到用户键入第一个字符后才会
我怎么知道我的代码何时完成循环?完成后我还得再运行一些代码,但只有当我在那里写的所有东西都完成后它才能运行。 obj.data.forEach(function(collection) {
我正在使用音频标签,我希望它能计算播放了多少次。 我的代码是这样的: ; ; ; 然后在一个javascript文件中 Var n=0; function doing(onplaying)
我正在尝试向 Package-Explorer 的项目上下文菜单添加一个子菜单。但是,我找不到该菜单的 menuid。 所以我的问题是如何在 eclipse 中找到 menuid? 非常感谢您的帮助。
我有一个名为“下一步”的按钮,它存在于几个 asp.net 页面中。实际上它是在用户控件中。单击“下一步”时,它会调用 JavaScript 中的函数 CheckServicesAndStates。我
我正在尝试在 Visual Studio 中使用 C++ 以纳秒为单位计算耗时。我做了一些测试,结果总是以 00 结尾。这是否意味着我的处理器(Ryzen 7-1800X)不支持 ~1 纳秒的分辨率,
我有一个自定义 ListView ,其中包含一些元素和一个复选框。当我点击一个按钮时。我想知道已检查的元素的位置。下面是我的代码 public class Results extends ListAc
如何在使用 J2ME 编写的应用程序中获取网络运营商名称? 我最近正在尝试在 Nokia s40 上开发一个应用程序,它应该具有对特定网络运营商的独占访问权限。有没有这样的API或库? 最佳答案 没有
我使用服务器客户端组件,当在此组件的 TransferFile 事件中接收文件时,我使用警报消息组件。所以我希望,如果用户单击警报消息,程序将继续执行 TransferFile 事件中的代码,以在单击
如果我创建一个类A具有一些属性,例如 a, b, c我创建对象 A x1; A x2; A x3; ... A xN 。有没有办法在同一个类中创建一个方法来检索我创建的所有对象?我想创建类似 stat
我正在制作一个应用程序,其中包含相同布局的 81 个按钮。它们都被称为我创建的名为“Tile”的对象。问题是这些图 block 存储在数组中,因此我需要知道以 int 格式单击了哪个按钮才能调用图 b
UIProgressView有这个setProgress:animated: API。 有没有办法确切知道动画何时停止? 我的意思是这样的? [myProgress setProgress:0.8f
我正在使用两个 jQuery 队列,我希望其中一个队列在另一个队列完成后出队。我怎么知道第一个是否完成?我应该使用第三个队列吗?! 这是我所拥有的: var $q = $({}); $q.que
jQuery 中有没有一种方法可以知道是否至少有一个复选框已被选中? 我有一个包含很多复选框的表单,每个复选框都不同。 我需要一种 jQuery 的方式来表达这样的内容,这就是逻辑: If at le
给定 2 个选择 100 50 100 在这两种情况下,我都想在 .example 中获取数字,使用相同的选择器或者以某种方式知道 .no-text 和 之间的区别。带文字 执行
我在我的应用程序中使用 System.ComponentModel.BindingList 作为 DataGridView.DataSource。该列表非常大,需要几秒钟才能绘制到 DataGridV
我想知道用户在 Android 中选择的默认键盘。我知道我可以使用 InputMethodManager 访问已启用的输入法列表,但我想知道用户当前使用的是哪一个。 到目前为止,我已经尝试获取当前的输
我是一名优秀的程序员,十分优秀!