Skip to main content
thomasm0013
November 21, 2022
Question

Dropdown/custom picker (to utilize auto suggestions) with the option to enter new values?

  • November 21, 2022
  • 4 replies
  • 0 views

Hello,

I'm looking for an text field (user input) which will auto suggest values (based on a database field). Afaik, that is something dropdown fields and with some more logical a customer picker can provide except they wont allow for new values to be entered.

What would be a good way (if any) to achieve this?

    4 replies

    stefanhelzle0001
    Brainy
    November 21, 2022

    That requires some tricks. A custom picker field expects a datasubset returned from the suggest function. That datasubset has a field called "identifiers" which is of type ANY. This means that you can put your whole record in it, instead of just the ID.

    When your user now looks for a non-existing item, you just have to add the entered search string to the field "data" and a new record (empty primary key!) to the identifiers field.

    I use this to provide a field to enter keywords mixing existing and new ones.

    thomasm0013
    November 23, 2022

    Thank you, that helped. Basically what I did was to enhance the pattern recipe-configure-an-array-picker.html

    • add the keyword
      • to the result list of the search function
      • to the value list of the customer picker

    (I did not yet needed an new record - but that is really nice to know that this would be achievable as well)

    shikhat
    November 24, 2022

    can you plx share some sample code for this?