PDA

View Full Version : Help, How do I set the parameters of the form is submitted by itemid



arpeggian
25 Jul 2012, 7:06 PM
Dear all,


I have a form, with fields identified by the Itemid, not by id.

var entryFormPanel = Ext.create('Ext.form.Panel', {
title: false,
id: 'entry-form-panel',
bodyPadding: 15,
collapsable: true,
defaultType: 'textfield',
height: 0.4 * contentHeight,
layout: 'hbox',
items: [
{
xtype: 'fieldset',
margin: '5 5 10 5',
border: false,
items: [{
fieldLabel: 'Idpelanggan',
itemId: 'idpel',
allowBlank: false,
margin: '0 5 0 0',
xtype: 'textfield',
},{
fieldLabel: 'Tahun',
itemId: 'tahun',
allowBlank: false,
xtype: 'textfield',
},{
fieldLabel: 'Bulan',
itemId: 'bulan',
allowBlank: false,
xtype: 'textfield',
},{
fieldLabel: 'Lwbp',
itemId: 'lwbp',
allowBlank: false,
margin: '0 5 0 0',
xtype: 'textfield',
},{
fieldLabel: 'Wbp',
itemId: 'wbp',
allowBlank: true,
margin: '0 5 0 0',
xtype: 'textfield',
},{
fieldLabel: 'Kvarh',
itemId: 'kvarh',
allowBlank: true,
margin: '0 5 0 0',
xtype: 'textfield',
}]
}
,{
xtype: 'fieldset',
margin: '5 5 10 5',
border: false,
items: [{
fieldLabel: 'Tgl Baca',
itemId: 'tgl_baca',
allowBlank: false,
xtype: 'datefield',
format: 'd/m/Y',
},{
fieldLabel: 'Catatan',
itemId: 'catatan',
margin: '0 5 0 0',
xtype: 'textarea'
},{
fieldLabel: 'Latitude',
itemId: 'lat',
margin: '0 5 0 0',
xtype: 'textfield',
},{
fieldLabel: 'Longitude',
itemId: 'long',
margin: '0 5 0 0',
xtype: 'textfield',
}]
}
],
buttons:[
{
text : 'Simpan',
iconCls: 'icon-save',
formBind: true, //only enabled once the form is valid
disabled: true,
handler: function(){
var form = this.up('form').getForm();


/*
,
record = form.getRecord(),
values = form.getValues();



if(form.isValid()){
if(!record){
record = Ext.create('SIMCater.model.entryStand');
record.set(values);
entryStandStore.add(record);
}else{
record.set(values);
alert('set');
}


entryStandStore.sync();


alert('sync');


}else{
Ext.Msg.alert('Erro', 'Formulário preenchido incorretamente');
}
*/

form.submit({
clientValidation: true,
scope:this,
url: sharedData.rootDir + 'app/stand/saveStand.php',
waitMsg: 'Menyimpan data...',
success: function(fp, o) {
Ext.Msg.alert('Pesan', 'Data berhasil disimpan');
},
failure: function(form, action) {
Ext.Msg.alert('Pesan', 'Data gagal disimpan');
}
});

if (form.isValid()) {
Ext.Msg.alert('Submitted Values', form.getValues(true));
}

//form.updateRecord();

}
}
,
{
text : 'Reset',
iconCls: 'icon-reset',
handler : function()
{
this.up('form').getForm().reset();
}
}
],
listeners: {
load: function(){
alert('load');
},
beforeload: function(){
alert('before load');
},
}
});

and when the form submitted, the following are the parameters
37482
how do I get the parameters that I send to the server can retrieve from the itemid of each field?
when itemId = 'idpelanggan'
param ==> idpelanggan : xxxxxxxxxxxxxxxxx

evant
25 Jul 2012, 7:30 PM
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Base-cfg-name

arpeggian
25 Jul 2012, 7:48 PM
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Base-cfg-name

Hi evant, thanks for replay.

I'll try it, but whether the attribute name must be unique to one document / application? or is this just has to be unique in one component / local, as well as itemid?


My main problem actually is .. http://www.sencha.com/forum/showthread.php?232279-Id-conflicts-in-multiple-tabs

scottmartin
26 Jul 2012, 10:16 AM
Unique to the component/class.

Scott.