Skip to content

Can't set value of select type field in form for edit #1299

@Flugelman

Description

@Flugelman

I've combed over the docs, tried a lot of things, and I cannot see any way to set the value of a search field using select and option_source in an edit form.

It works fine from scratch on my add form to make a new record, but in the edit form on an existing record this field always comes up blank. I've tried setting value, selected, and label_value at the row level in the form SQL, I've tried using some json like this (per a forum post):

select 'json' as component;

SELECT 
  tracks.id AS value, 
  tracks.title AS label,
  tracks.id = CAST($track_key AS INT) AS selected
FROM tracks
WHERE lower(title) LIKE '%' || lower($search) || '%';

But that fails with an error message saying that the json array only supports label and value keys.

So how exactly does one successfully use a select type with a pre-set value for edit?

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions