The scenario is I have an HTA that I use to communicate with a database through a telnet like client. It performs macro's and such for me. It's written in VBS to communicate with the client.

I'm attempting to add autocomplete functionality to it using Jquery. The problem however is I have an external file that hold's a list of items that I load into the HTA at startup and turn those into select options.

Based on the one option that is selected I return the value and text, and use that to carry out my macro. I thought about changing my file from just a normal textfile with the values being separated by hyphons into an XML file.

The problem is I'm not quite sure how to pass the selected option back to VBS based on the Jquery autocomplete code I'm seeing, and I've seen a lot at this point.

So is it possible to use Jquery to add a search field that picks a select option that is loaded from an external file and pass it back to VBS?

Replies(3)

Ok, you're doing a lot of stuff that I know nothing about, but I'll take a shot at the Autocomplete part.

It sounds like you have a combobox - option values in an HTML select. Its just that the option items are dynamically loaded. If that is the case, I'd advise against using the jQuery Combobox widget that is in the documentation section. It is very complex. You may have better luck using the Combobox plug-in provided by Jonathan Tang. It is set up with options and you can put any function you want into the options. As a hypothetical, the open: option might contain your code to contact " an external file that hold's a list of items that I load into the HTA at startup and turn those into select options" Once you have select options, use a function in the source: option to "return the value and text, and use that to carry out my macro." Or something like that.

In jQuery, one common way to get data from a server is the getJSON(); function. It does what it says. You then have an array that other jQuery or Javascript functions can access for its data contents. If that sounds interesting, take a look at the getJSON documentation. Its a simplified expression to "magically" create an ajax and return a JS array of JSON. If you end up needing help, the Getting Started forum can give you help with getJSON()