PDA

View Full Version : Several form fields with the same name



AlexShurik
27 Jul 2014, 1:41 AM
Please, help me, i only started learn ExtJS but already have a problem.
I created window with lot's fields such as: shortname, fullname..., and several phone fields with name phones[]. When i'm saving it, i don't have the problem, and my phones saved to database field like
"["11111111111","222222222225","555555555555555","44444444444","555555555"]"
But when i open update window my phone fields is empty. What should i do. Please give me some examples for resolving this task.
This is my update window

Doodles.window.UpdateDoodle = function(config) {
config = config || {};
Ext.applyIf(config,{
url: Doodles.config.connectorUrl
,title: _('doodles.doodle_update')
,baseParams: {
action: 'mgr/doodle/update'
}
,width: 1400
,fields: [{
xtype: 'modx-tabs'
,activeTab: 0
,bodyStyle: 'padding: 10px'
,defaults: { border: false ,autoHeight: true }
,border: true
,items:[{
title: '????????'
,defaults: { autoHeight: true }
,bodyStyle: 'padding: 0px'
,items:[{
layout: 'column'
,defaults: {msgTarget: 'under',border: false}
,items: [{
layout: 'column'
,items: [{
layout: 'form'
,columnWidth: 1
,items: [
{ xtype: 'textfield'
,fieldLabel: _('doodles.fullname')
,name: 'fullname'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: _('doodles.shortname')
,name: 'shortname'
,anchor: '100%'
},{

layout: 'column'
,fieldLabel: _('doodles.phones')
,anchor: '100%'
,defaults: {msgTarget: 'under',border: false}
,items: [{
layout: 'form'
,items: [
{xtype: 'textfield', name: 'phones[]', width: '106', maskRe:/[0-9]/i}


]
},{
layout: 'form'
,items: [
{xtype: 'textfield', name: 'phones[]', width: '106', maskRe:/[0-9]/i}
]
},{
layout: 'form'
,items: [
{xtype: 'textfield', name: 'phones[]', width: '106', maskRe:/[0-9]/i}
]
},{
layout: 'form'
,items: [
{xtype: 'textfield', name: 'phones[]', width: '106', maskRe:/[0-9]/i}
]
},{
layout: 'form'
,items: [
{xtype: 'textfield', name: 'phones[]', width: '106', maskRe:/[0-9]/i}
]
}]

}]
}]

}]


}]
}]
});


Doodles.window.UpdateDoodle.superclass.constructor.call(this,config);
};
Ext.extend(Doodles.window.UpdateDoodle,MODx.Window);
Ext.reg('doodles-window-doodle-update',Doodles.window.UpdateDoodle);

mitchellsimoens
29 Jul 2014, 9:45 AM
Sounds like your backend needs to handle the fields being sent to it better, it looks like it's getting the data, just needs to handle how it's coming.

AlexShurik
29 Jul 2014, 11:45 AM
Sounds like your backend needs to handle the fields being sent to it better, it looks like it's getting the data, just needs to handle how it's coming.

Give me some examples, please

mitchellsimoens
29 Jul 2014, 11:48 AM
I have zero clue what your server is like so I have no examples to give.