Extjs 4.x gets the value of the form CheckBox


A CheckBox is primarily used to receive options selected by the user

As shown in the figure (please ignore the ugly UI) :

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.