Dynamic valuelist

Hi,

I use a combox attach to a valuelist from a relation o my table and it works very well.

Now I want to allow users to add a new item in my valuelist if this item don’t exist.

But I don’t know how do that. What method use on my combobox (onChange, onFocus,…) ? Do I need to use SetValueListItem ?

Kind Regards.

If you make the combobox editable, users can type any value into the field or select an existing value from the dropdown.

Note: this only works for valuelists that return the same value as the is displayed

Note2: currently, an editable ComboBox is not supported in the WebClient in Servoy 3.0

Paul

ok

My combobox return a integer and display a text :confused:

Perhaps it’s possible if I make a script with find and search methods on database and if I add the new item if it doesn’t exist.

I’dd says a typeAhead field is the best option…

I agree with Paul on the typeAhead

chgog:
What method use on my combobox (onChange, onFocus,…) ? Do I need to use SetValueListItem ?

SetValueListItem() can be used in combination with a custom valuelist. In your own case, with a valuelist based on a relation you only need to create a new record (like relationname.newRecord()).
You can use a method on the onDataChange of the field to check if the typed value already exists.

My combobox return a integer and display a text

So when I enter a text on the type_head field, the onChange methode return nothing.

The following thread seems to answer your questions…

http://forum.servoy.com/viewtopic.php?t … uelistitem

However, I believe, the best way to go about allowing the user enter information in a valuelist is to create a separate table / form that they go to to enter and delete values. You can ultimately control the numeric values that are entered into the column on backend in either a sequential or programatic manner.