PDA

View Full Version : returning a textfield value from External JS



MrSparks
5 Sep 2010, 7:28 AM
I've have a ETX JS textfield on my west panel, which uses listener to call an external JS on a keyup event.

The call from the keyup event to the external JS is successful but then fails within the actual external JS function.

This is the troublesome area...

myvalue = document.getElementById('mytextfield').value; Firebug throws the following error “document.getElementById(“mytextfield”) is null”

How does one reference the ID of a textfield when using external JS?

I'll also need to right the response back, which agian i think wont work with EXT JS?

document.getElementById('results').innerHTML=response;Please Help :)

MrSparks
5 Sep 2010, 1:30 PM
Ok, figured this out only to leave another issue. Maybe a show stopper. Appreciate any thoughts on this one.

The current situation is.

I'm able to display the response to a DIV with the id of "mytextfield". I now want to display the response in the child node of a TreePanel, which is waht i'm am having difficulty doing.

I've tried

text:'<div id="mytextfield"></div>

and

text:'<a id="mytextfield"></a>
This actually works to a fashion, however causes some serious css display issues on the tree nodes!

Condor
6 Sep 2010, 1:35 AM
I assume that it should be an Ext.form.TextField with id:'mytextfield'.

MrSparks
6 Sep 2010, 1:58 AM
I assume that it should be an Ext.form.TextField with id:'mytextfield'.

@Condor

Figured out that the CSS issues were related the formatting of the strings I was returning to the Treepanel Node.

Out of interest, what would be best practice for inserting remote textual content into a TreePanel node? As above, I’m simple using

text:'<a id="result"></a>

Which seems to work fine.

Where I’m going with this is.... creating a dynamic set of nodes using an Ajax based live search. Similar to the remotetreepanel plugin. The difference being I’m using CF and don’t need a lot of the remotetreepanel functionality.