PDA

View Full Version : How do you get TextField to execute setValue()?



IvanJ
5 Nov 2009, 11:26 AM
I'm learning ExtJS (with Coolite kit) and trying to perform a very simple operation - look up textfield by ID and set its value. I managed to do it using a hack:


Ext.getDom("TF8").value=codeBehindParam;

Now, I'm trying to do it the proper way:


((Ext.form.Field)(Ext.getCmp("TF8"))).setValue(codeBehindParam);

... but it's not working. On the first page request there's a JS error "this.addEvents is not a function"; on subsequent requests there are no errors, but nothing is happening. Any idea?

VinylFox
5 Nov 2009, 11:39 AM
Whats with all the extra parenthesis? Is that a Coolite thing?

Just this should do it...assuming your text field has been created already.


Ext.getCmp("TF8").setValue(codeBehindParam);

Animal
5 Nov 2009, 11:42 AM
It looks like Java casting.

There are no classes in Javascript.

IvanJ
5 Nov 2009, 12:18 PM
Thanks VinylFox, that worked!

Animal, looks like I gotta get my JS skills back in shape :) Haven't touched it in almost 4 years.