Sencha touch 未从字段集的某些字段获取值
我试图从包含姓名、手机号码、电子邮件地址和所有这些内容的字段集中获取值。这是我的字段集代码:Sencha touch 未从字段集的某些字段获取值,sencha-touch,extjs,Sencha Touch,Extjs,我试图从包含姓名、手机号码、电子邮件地址和所有这些内容的字段集中获取值。这是我的字段集代码: { xtype : 'fieldset', docked : 'top', id: 'signuptextfield', margin : '10 0 0 0', width : 600,
{
xtype : 'fieldset',
docked : 'top',
id: 'signuptextfield',
margin : '10 0 0 0',
width : 600,
scrollable: true,
height : 180,
items : [ {
xtype : 'textfield',
id : 'consumername',
style : 'font: Droid Sans',
label : 'Consumer Name',
labelWidth : '30%'
}, {
xtype : 'numberfield',
id : 'mobilenum',
style : 'font: Droid Sans',
label : 'Mobile',
labelWidth : '30%'
}, {
xtype : 'emailfield',
id : 'email',
label : 'Customer Email id',
labelWidth : '30%',
placeHolder : 'email@example.com'
}, {
xtype : 'textareafield',
id : 'adressfield',
style : 'font: Droid Sans',
label : 'Address',
labelWidth : '30%'
}, {
xtype : 'textfield',
id : 'areafield',
style : 'font: Droid Sans',
label : 'Area/Location',
labelWidth : '30%'
}, {
xtype : 'selectfield',
label : 'City',
labelWidth : '30%',
options : [ {
text : 'Bangalore',
value : 'first'
}, {
text : 'Delhi',
value : 'second'
}, {
text : 'Mumbai',
value : 'third'
} ]
}, {
xtype : 'numberfield',
id : 'pinfield',
style : 'font: Droid Sans',
label : 'Pincode*',
labelWidth : '30%'
}, ]
}, {
xtype : 'button',
height : 40,
id : 'submitbtn',
margin : '10 0 0 0',
ui : 'orange',
width : 220,
text : 'Submit'
}
现在,在“提交”按钮中单击,我尝试获取以下值:
首先,我尝试使用以下代码:
var consumerName = Ext.getCmp('signuptextfield').getValues();
onSubmitButtonTap : function(button, e, options) {
function storeCustomerDetails(tx)
{
var consumerName = Ext.getCmp('consumername').getValue();
var consumerMobNo = Ext.getCmp('mobilenum').getValue();
var consumerEmail = Ext.getCmp('email').getValue();
var consumerAddress = Ext.getCmp('adressfield').getValue();
var consumerArea = Ext.getCmp('areafield').getValue();
console.log("the datas are:"+consumerName);
console.log("the datas are:"+consumerMobNo);
console.log("the datas are:"+consumerEmail);
console.log("the datas are:"+consumerAddress);
console.log("the datas are:"+consumerArea);
}
但这是一个错误:
Uncaught TypeError: Object [object Object] has no method 'getValues' at file:///android_asset/www/app/controller/MyController.js:164
然后我尝试使用以下代码:
var consumerName = Ext.getCmp('signuptextfield').getValues();
onSubmitButtonTap : function(button, e, options) {
function storeCustomerDetails(tx)
{
var consumerName = Ext.getCmp('consumername').getValue();
var consumerMobNo = Ext.getCmp('mobilenum').getValue();
var consumerEmail = Ext.getCmp('email').getValue();
var consumerAddress = Ext.getCmp('adressfield').getValue();
var consumerArea = Ext.getCmp('areafield').getValue();
console.log("the datas are:"+consumerName);
console.log("the datas are:"+consumerMobNo);
console.log("the datas are:"+consumerEmail);
console.log("the datas are:"+consumerAddress);
console.log("the datas are:"+consumerArea);
}
但我只能得到消费者的姓名和手机号码。其他字段返回空..我不知道确切的问题出在哪里
需要帮助。是我一个人,还是有虚构的X类型用于无法获取内容的字段?如果我将字段集放在表单面板中,我可以访问该值。这样我就解决了问题。但是,如果我的屏幕中没有字段集,并且我试图使用getCmp获取文本框的值,那么我就不会获取文本框的值。。