Extjs 4.x gets the value of the form CheckBox
- 2020-03-30 02:48:57
- OfStack
A CheckBox is primarily used to receive options selected by the user
As shown in the figure (please ignore the ugly UI) :
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201405/201405041125182.gif? 201444112536 ">
The main code of the pop-up window is as follows:
The window that pops up is the carrier, and the [fp] inside the items is the handle to the form.
The specific definition is as follows:
This basically covers all the information of interest. See the API bar itself for details
Let's focus on getting the value of the checkBox
These two sentences are how to get the values of completeness and correctness.
As shown in the figure (please ignore the ugly UI) :
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201405/201405041125182.gif? 201444112536 ">
The main code of the pop-up window is as follows:
var win = new Ext.Window({
modal : true,
title : ' Are you sure you want to reject the form? ',
width : 500,
plain : true,
items : [fp]
});
win.show();
The window that pops up is the carrier, and the [fp] inside the items is the handle to the form.
The specific definition is as follows:
var fp = Ext.create('Ext.FormPanel', {
frame: true,
fieldDefaults: {
labelWidth: 110
},
width: 500,
bodyPadding: 10,
items: [
{
xtype: 'fieldset',
flex: 1,
//Title: 'are you sure you want to reject this form? ',
defaultType: 'checkbox',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items:[{
fieldLabel: ' Please choose the reason for rejection :',
boxLabel: ' The form is incomplete. ',
name:'integrity',
inputValue: '1'
}, {
name:'correct',
boxLabel: ' The form is not filled out accurately. ',
inputValue: '1'
}]
}],
buttons: [
{text: ' confirm ',handler: function(){
//To get the completeness and accuracy information is either 1 or 0
if(fp.getForm().isValid()){
console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)
}
win.hide();
}
},{
text: ' cancel ',
handler: function(){
win.hide();
}
}]
});
This basically covers all the information of interest. See the API bar itself for details
Let's focus on getting the value of the checkBox
console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)
These two sentences are how to get the values of completeness and correctness.