PDA

View Full Version : TextField getValue returns undefined



amedeoviscido
7 Mar 2008, 7:14 AM
Hi, I have this little bit of code:



var frmPratiche = new Ext.FormPanel({
width: 350,
height: 100,
frame: true,
labelWidth: 150,
bodyStyle:'padding:5px 5px 5px',
defaults: {width: 150},
defaultType: 'textfield',
items: [{
fieldLabel: 'Numero telefonico',
name: "numero_pratica",
value: "TEST ME",
allowBlank:false
}],
buttons: [{
text: 'Visualizza pratica',
handler: function() {
var val = frmPratiche.getForm().getEl("numero_pratica").getValue();
var win = new Ext.Window({
title:'Dettagli lavorazione ' + val,
width:500,
height:500,
closeAction:'close',
plain: false,

buttons: [{
text: 'Chiudi',
handler: function(){
win.close();
}
}]
});

loadPage(win, "dati.php",{telef_code:val});
win.show();
}
}]
});


At this point of the code there is my problem:

var val = frmPratiche.getForm().getEl("numero_pratica").getValue(false);

"val" is always undefined. Why???

Animal
7 Mar 2008, 7:21 AM
BasicForm.getEl() is going to return an Ext.Element wrapping a <form>

A form does not have a value.

amedeoviscido
7 Mar 2008, 7:33 AM
hem... sorry but I'm a noob. What shall I do???

Animal
7 Mar 2008, 7:36 AM
WHat do you want to do?

amedeoviscido
7 Mar 2008, 7:41 AM
I would like to retrieve the text that the user writes into the "numero_pratica" textfield, but how :-? ???

Condor
7 Mar 2008, 7:48 AM
Use:


var value = frmPratiche.getForm().findField("numero_pratica").getValue();

amedeoviscido
7 Mar 2008, 7:50 AM
great, thank you :D
You can close this post