Auto-complete

Archived from the Xataface Users forum.

rwzhao — Mon Sep 01, 2008 10:09 pm

Hello!

Searched the forum and could not find a tutorial for auto-complete input. Any hints, it will be very helpful.

Thanks.


shannah — Tue Sep 02, 2008 12:13 am

It works the same way a select widget works. There are two types of autocomplete widgets.

  1. autocomplete

This is just a text field that tries to autocomplete what you are typing based on a valuelist. It doesn’t provide a drop-down list of options.

  1. yui_autocomplete

This is the YUI autocomplete widget. It provides a drop-down list of options for autocomplete.

e.g.

Code: Select all
[myfield]     widget:type=autocomplete     vocabulary=myvaluelist

or

Code: Select all
[myfield]     widget:type=yui_autocomplete     vocabulary=myvaluelist

This page may also be helpful http://xataface.com/wiki/widget%3Atype

-Steve


rwzhao — Tue Sep 02, 2008 4:09 pm

Thanks. Steve.

Thanks for your link.

On the data input, the input field is INT and the autocomplete field lookup is based on VAR field. I was able to get auto-complete VAR value into INT field. But I need INT value to be submitted to the Database. How can I do it. Here is what I have:

fields.ini contains:

[pol]

widget:type = yui_autocomplete

vocabulary = pols

valuelists.ini contains:

[pols]

__sql__ = “SELECT p_id, port_name FROM ports ORDER BY port_name”

I need p_id value to be into filed pol. Now I can only put port_name value there.

Any suggestion?

-Richard


shannah — Tue Sep 02, 2008 6:13 pm

Ah yes… unfortunately the autocomplete widgets don’t currently support having different display and storage values.

Your pretty much stuck with a standard select widget unless you want to rig up your own concoction.

Best regards

Steve