更新时间:2023-10-05 23:03:22
我希望你可以在我的例子中找到
Ext.onReady(function(){
var newForm = Ext.create('Ext.form.Panel',{
title:Form ,
items:[
{
xtype:textfield,
fieldLabel:Name
},
{
xtype:' textareafield',
名称:'message',
fieldLabel:'Message'
}
],
renderTo:document.body
});
var win = new Ext.Window
({
title:Window,
layout:'fit',
height:250,
宽度:300,
项目:[newForm],
按钮:[
{
文本:提交,
处理程序:function(){
var textFieldValue = newForm.items.items [0] .getValue();
var textAreaValue = newForm.items.items [1] .getValue();
if(textFieldValue!= || textAreaValue!=){
alert(你可以提交数据);
}
else {
alert(你不能提交数据 );
}
}
}
]
})。show();
});
I am using ExtJS 3.4.0
I have a form in "var new" variable that comes to Ext.Window().
I need to do code that checks between textfield and textarea is one of them empty or not.
I mean if textfield is empty and textarea is not then form data can be submitted vice versa.
This code must be placed to the code that starts like below:
newform
.getForm()
.submit(
I hope you can find in my example
Ext.onReady(function(){
var newForm=Ext.create('Ext.form.Panel',{
title:"Form",
items:[
{
xtype:"textfield",
fieldLabel:"Name"
},
{
xtype : 'textareafield',
name : 'message',
fieldLabel: 'Message'
}
],
renderTo:document.body
});
var win= new Ext.Window
({
title:"Window",
layout:'fit',
height:250,
width:300,
items:[newForm],
buttons:[
{
text:"Submit",
handler:function(){
var textFieldValue=newForm.items.items[0].getValue();
var textAreaValue=newForm.items.items[1].getValue();
if(textFieldValue!=""||textAreaValue!=""){
alert("you can submit the data");
}
else{
alert("you can't submit the data");
}
}
}
]
}).show();
});