PDA

View Full Version : HELP!!! VARIABLE AS A VALUE IN A FORM.TEXTFIELD



xerrano
29 Oct 2007, 9:53 PM
I try to pass the emailto variable value to the - To value TextField -
But it does not work, even the form stops showing on the screen. When I take the value line out all the form shows fine. ANY IDEA HOW TO USE A VARIABLE AS A "VALUE" IN A FORM.TEXTFIELD? :((

ds.on("load", function(){
var firstRec = ds.getAt(0);
emailto = firstRec.get("peopleemail");
alert(emailto);
});

// I test the alert and it shows fine.


new Ext.form.TextField({
fieldLabel: 'To',
name: 'formTo',
vtype:'email',
hidden: 'true',
value: emailto, >:)
width:175,
allowBlank:true
}),


THANKS AGAIN!!

Felipe Serrano

Animal
30 Oct 2007, 12:48 AM
That will work if a value has actually been put into the variable at the time the TextField is created.

If you extract the value from a Store, then the field will already have been created won't it? so setting any variable then won't affect an already created field.

You'll have to get a refeence to the Field, and call setValue on it.