Home  >  Article  >  Web Front-end  >  Extjs 4.x Get the value of the form CheckBox check box_extjs

Extjs 4.x Get the value of the form CheckBox check box_extjs

WBOY
WBOYOriginal
2016-05-16 16:50:061199browse

CheckBox is mainly used to receive the options selected by the user

as shown in the picture (please ignore the unsightly UI):

Extjs 4.x Get the value of the form CheckBox check box_extjs

This popup The main code of the window is as follows:

Copy code The code is as follows:

var win = new Ext. Window({
modal : true,
title : 'Are you sure you want to reject this table?',
width : 500,
plain : true,
items : [fp]
});
win.show();

The pop-up window is the carrier, and [fp] in items is the handle of the form.

is specifically defined as follows:
Copy code The code 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 table? ',
defaultType: ' checkbox',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items:[{
fieldLabel : 'Please select the reason for rejection:',
boxLabel: 'The form is not completed',
name:'integrity',
inputValue: '1'
}, {
name. :'correct',
boxLabel: 'The form is not filled in accurately',
inputValue: '1'
}]
}],
buttons: [
{text: 'Confirm', handler: function(){
//If the completeness and accuracy information is obtained, it will be 1, if not 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. For details, please refer to the API. It is not difficult

Focus on getting the value of checkBox
Copy the code The code is as follows:

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.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn