Auto complete text field is similar to a drop down list, as a visitor types into the text field, a list of selectable options will appear. But this auto complete text field is not the same as a Combo Box.
To implement this auto complete text field, common.js and actb.js are required. These files can be downloaded from here.
Then do the following steps:
- Firstly, include the .js file into your script
<script type=”text/javascript” src=”library/actb/actb.js”></script>
<script type=”text/javascript” src=”library/actb/common.js”></script> - Create a standard single line text field.
<input type”text” id=”textbox_id”>
- Create an array (in JavaScript) containing the keywords
<script type=”text/javascript”>
var customarray = new Array(‘apple’,'pear’,'mango’,'pineapple’,'orange’,'banana’,'durian’, ‘jackfruit’,'etc’);
</script> - Apply the widget. This script must be created AFTER the text field is created.
<script type=”text/javascript”>
actb(document.getElementById(‘textbox_id’),customarray);
</script>
And you’re done!