PDA

View Full Version : How to pass a field value of a form to another form



lpastor
26 Aug 2009, 8:16 AM
Hello,

The user fills out a form, click on the button NEXT and complete a second form.

I would like the value of a field in the first form is transmitted to the second.

I tried to implement it on the button NEXT :



var cardNav = function(incr){
var l = Ext.getCmp('card-wizard-panel').getLayout();
var i = l.activeItem.id.split('card-')[1];
var next = parseInt(i) + incr;
l.setActiveItem(next);
Ext.getCmp('card-prev').setDisabled(next==0);
Ext.getCmp('card-next').setDisabled(next==2);
Id_Contact = Ext.getCmp('id_contact').getValue();
Ext.MessageBox.alert('Info','value='+Id_Contact);
Ext.getCmp('id_contact_demande').setValue(Id_Contact); // Error Is Undefined
};

var cardWizard = {
id:'card-wizard-panel',
layout:'card',
activeItem: 0,
bodyStyle: 'padding:15px',
defaults: {border:false},
bbar: ['->', {
id: 'card-prev',
text: '« Précédent',
handler: cardNav.createDelegate(this, [-1]),
disabled: true
},{
id: 'card-next',
text: 'NEXT »',
handler: cardNav.createDelegate(this, [1])
}],
items: [{
id: 'card-0',
items: [gridForm1] // First form
},{
id: 'card-1',
items: [gridForm2] // Second form
}]
};After that I tried an other solution on the form 2 :


var gridForm2 = new Ext.FormPanel({
frame: true,
width:650,
labelAlign: 'left',
layout: 'column',
items: [{
xtype: 'fieldset',
labelWidth: 90,
defaultType: 'textfield',
autoHeight: true,
border: false,
listeners: {
afterlayout: function(g){
Id_Contact = Ext.getCmp('id_contact').getValue();
Ext.getCmp('id_contact_demande').setValue(Id_Contact); // Error is undefined
Ext.MessageBox.alert('Info2','value='+Id_Contact);
}
},
items: [
{name:'id_demande', width:30, hidden:false, allowBlank: true},
{name:'id_contact_demande', width:30, value:Id_Contact, hidden:false, allowBlank: true},
...
...

lpastor
26 Aug 2009, 8:19 AM
Hello,

The user fills out a form, click on the button NEXT and complete a second form.

I would like the value of a field in the first form is transmitted to the second.

I tried to implement it on the button NEXT :



var cardNav = function(incr){
var l = Ext.getCmp('card-wizard-panel').getLayout();
var i = l.activeItem.id.split('card-')[1];
var next = parseInt(i) + incr;
l.setActiveItem(next);
Ext.getCmp('card-prev').setDisabled(next==0);
Ext.getCmp('card-next').setDisabled(next==2);
Id_Contact = Ext.getCmp('id_contact').getValue();
Ext.MessageBox.alert('Info','toto='+Id_Contact);
Ext.getCmp('id_contact_demande').setValue(Id_Contact); // Error Is Undefined
};

var cardWizard = {
id:'card-wizard-panel',
layout:'card',
activeItem: 0,
bodyStyle: 'padding:15px',
defaults: {border:false},
bbar: ['->', {
id: 'card-prev',
text: '« Précédent',
handler: cardNav.createDelegate(this, [-1]),
disabled: true
},{
id: 'card-next',
text: 'Suivant »',
handler: cardNav.createDelegate(this, [1])
}],
items: [{
id: 'card-0',
items: [gridForm1] // First form
},{
id: 'card-1',
items: [gridForm2] // Second form
}]
};

lpastor
26 Aug 2009, 8:20 AM
This message work, then why my others post are moderate ?

lpastor
26 Aug 2009, 8:25 AM
Hello,

The user fills out a form, click on the button NEXT and complete a second form.

I would like the value of a field in the first form is transmitted to the second.

I tried to implement it on the button NEXT :



var cardNav = function(incr){
var l = Ext.getCmp('card-wizard-panel').getLayout();
var i = l.activeItem.id.split('card-')[1];
var next = parseInt(i) + incr;
l.setActiveItem(next);
Ext.getCmp('card-prev').setDisabled(next==0);
Ext.getCmp('card-next').setDisabled(next==2);
Id_Contact = Ext.getCmp('id_contact').getValue();
Ext.MessageBox.alert('Info','toto='+Id_Contact);
Ext.getCmp('id_contact_demande').setValue(Id_Contact); // Error Is Undefined
};

var cardWizard = {
id:'card-wizard-panel',
layout:'card',
activeItem: 0,
bodyStyle: 'padding:15px',
defaults: {border:false},
bbar: ['->', {
id: 'card-prev',
text: '« Précédent',
handler: cardNav.createDelegate(this, [-1]),
disabled: true
},{
id: 'card-next',
text: 'Suivant »',
handler: cardNav.createDelegate(this, [1])
}],
items: [{
id: 'card-0',
items: [gridForm1] // First form
},{
id: 'card-1',
items: [gridForm2] // Second form
}]
};

After that I tried an other solution on the form 2 :


var gridForm2 = new Ext.FormPanel({
frame: true,
width:650,
labelAlign: 'left',
layout: 'column',
items: [{
xtype: 'fieldset',
labelWidth: 90,
defaultType: 'textfield',
autoHeight: true,
border: false,
listeners: {
afterlayout: function(g){
Id_Contact = Ext.getCmp('id_contact').getValue();
Ext.getCmp('id_contact_demande').setValue(Id_Contact); // Error is undefined
Ext.MessageBox.alert('Info2','value='+Id_Contact);
}
},
items: [
{name:'id_demande', width:30, hidden:false, allowBlank: true},
{name:'id_contact_demande', width:30, value:Id_Contact, hidden:false, allowBlank: true},
...
...

lpastor
26 Aug 2009, 8:33 AM
OK I understand, I have put bold and colored text in my message, and somethink was not good ?

Sorry for the moderator if there is one?

Laurent

tryanDLS
26 Aug 2009, 9:26 AM
Your thread was likely flagged as moderated b/c of duplicate posts.

Please stop posting the same question multiple times - I have already deleted 3 other similar posts.

lpastor
26 Aug 2009, 10:58 AM
I am sorry TryanDLS at first I did not know that my message was moderate and then tried to understand why ...

Nobody has answered my original question ?

Laurent