- Whitehorses - http://blog.whitehorses.nl -

[Oracle APEX 4.0] Text Field with autocomplete

Tweet [1]

In previous APEX versions there is a lot of functionality you can add by simply incorporating some custom javascript. One example is a text field that shows an inline list of values for an item based on a query. Of course this is great functionality to provide to the user, but not that great for maintainability because of the custom code. APEX 4.0 now provides this functionality out of the box with the new item type Text Field with autocomplete.
[2]

Now you can declaratively create an item that provides an inline list of values that also filters while typing in the item. The list is populated by the list of values defined for the item, this can only be a dynamic list of values. There are several options when creating this item type.
[3]
An explanation of some of the options:

We create an example autocomplete item P6_DEMO_STATE that list all of the states from the table demo_states. The search type is set to Contains & Ignore Case and the search is highlighted. This gives the following result in our page:

[4]

The new Text Field with autocomplete really gives something extra to the user interface. Of course you should be cautious on what table you define this item, because it generates a lot of queries, especially with the Lazy Loading set to yes. All in all, another nice new feature in APEX 4.0.