AJAX example - Textinput auto complete

AJAX example - Textinput auto complete

Here's a simple AJAX (Asynchronous Javascript And Xml) example that demonstrates a Textinput auto complete. In the sample page, type in and check the auto complete suggestions. These suggestions are retrieved from the server asynchronously without posting the entire page

. Firstly, we found this cool auto complete script implementation at The Code Project and we dumped it into a Web Block Javascript Property.
. Then we replaced the static dictionary with an asynchronous request to the server using the XmlHttpRequest DLL (The AJAX pattern everyone is talking about).

Fell free to enhance it and let us know about it,
Have fun!
While trying to use the sample I found that the autocomplete failed to work on FireFox.
I changed the javascript function actb_refreshKeywords to:
function actb_refreshKeywords (){
req_async.onreadystatechange = function () {
req_async.open("GET", URL4Refresh + actb_curr.value,true );
function CallBack() {
if (req_async.readyState == 4 && req_async.status == 200) {
this.actb_keywords = req_async.responseText.split (',');

It now works for both Firefox and IE.

I also added the tag autocomplete="OFF" to avoid the autocomplete feature.
I've modified the above sample, to include the ID field on the generated dropbox like:

[id] text

Whenever a user clicks the selection the id goes to a texbox and the text goes to another.

Tipically you can hide the textbox that will contain the id and use it to get the data on the postback.

You must erase the ID field whenever the user types another thing besides the drop box items. ( not done.)

Best regards

I was an problem with implemention of AjaxCombo in my application.
It happens when i change the first combo and appear the follow javascript error : Type Error, Object Required.
The error is in condition "for(var i = 0; i < root.childNodes.length; i++)" when call the function "showEntityComboResponse(originalRequest)"

Everyone help me?


Nelson Santos

where do I get the EMS extension, mentioned in one comment of the autocomplete sample?

Thank you

Another extension is available that provides that functionality.
Here's how you can replace the EMS extension by the BinaryData extension:
1 - Download and publish the extension BinaryData
2 - Click Add/Remove References and add a reference to that extension
3 - Right click on EMS.TextToBin on the actions tree in the left side of Service Studio, choose "Find and Replace Usages" and select BinaryData.TextToBinaryData
4 - Click Add/Remove References and remove the reference to the EMS extension.

Hope this helps,
Tiago Simões

It seems that there's a problem with the scroll actions in the autocomplete list of values. Once you click the bottom scroll, then the upper one, scroll actions seem to disappear. Has anyone had this problem and has a fix for it?
If you comment 2 lines
r.style.backgroundColor = actb_self.actb_bgColor;
in the actb_remake(). funtion, the error disappears, with no interface problem.
There's a typo in the code: search and replace "actb_curractb_bgColor" by "actb_curr.actb_bgColor".

This problem also affects: WidgetLibrary / Styleguide.

Paulo Ramos
This problem is fixed in WIdgetLibrary 1.2.1

Gustavo Guerra

I'm trying to use the latest widgetlibrary autocomplete version, but I'm not getting the result expected. Maybe I'm doing something wrong

First I created a blank webscreen and output to it, the desired list of values (like this: ",abc,def,ghi,jkl," withouth the ")

I added the widget, created the entrypoint and it works....sort of.

The problem is with words that have characteres like ç, ã, à, á,....since they appear, once selected, in the text box in the form '&#231', '&#227',...

Other problem is I get values like : "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran...." that are a part of the asp code of the page.

How can I fix that or what am I doing wrong?


Hi Nuno,

I'm saying this by heart so forgive me if I'm wrong.

I think that the problem you have is that you're output your result in the webscreen rather then outputing it using the TextToBinary and the download widget. What you need to do is in the preparation of the webscreen you must end it with a download action that outputs the binary conversion of the text your search returned.

I hope this helps you,
Thanks andré, it makes sense

However, in the meantime I got around playing with the autocomplete javascript and got the desired effect.

I'll keep your suggestion in mind in case "my version" doesn't work correctly under some circumstances.


I'm trying use the autocomplete but i have this problem:

- for exemple when i put the number 12 i just liked that appear only numbers startings with 12, but they are appearing all the vallues that have the 12

- If i have the numbers 1234, 1256 and 1912 i just want appear the 1234 and 1256.

Best Regards

Filipe Alves
Hi Filipe,

To do that you can:
1 - open the autocomplete.oml,
2 - go to AutocompleteInstance web block
3 - open the web block javascript and change this line
      this.actb_firstText = true; // should the auto complete be limited to the beginning of keyword?
Tiago Simões
Hi Tiago,

Thanks for your help!


Filipe Alves