Use Queries with Ajax Autocomplete
Want to use filtered tables?
Question:
How can I use queries in the Ajax Autocomplete field?
Answer:
When setting the options for the Ajax Autocomplete extension in the User Interface,only tables can be selected in the Table field when setting all the Provider Properties for a database connection. To use a filter for the autocomplete field, manual changes have to be made to the file containing the connection settings. This file has to becreated first. Select a Connection, a Table, a primary field and if needed one or more optional fields. Click OK go save the settings.
If the Ajax Autocomplete field was entered on a page called mypage.asp, the connections settings are stored in a file called autocomplete-mypage-asp-1.asp. Open the file that was created automatically and browse to the first piece of code. On the line that starts with sTable =, edit the value for the Table and replace it with the name of the Query. Check if the values for sPrimary (the primary field) and sOptional (one or more optional fields) are still correct.
Dim sTable
sTable = "MyFilteredQuery"
Dim sPrimary
sPrimary = "MyTable_PrimaryField"
Dim sOptional
sOptional = "MyTable_OptionalField1"
Save the file and upload it to the live server. When the autocomplete field is now used, the values for the query will be presented.
Note: The change to use a query can best be done when it is clear that all other settings are OK. If the change has been made in Code View and afterwards changes to the Ajax Autocomplete have to be made through the User Interface, all the manual settings will be overwritten.
Comments
Be the first to write a comment
You must me logged in to write a comment.