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!
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, andlabel_valueat the row level in the form SQL, I've tried using some json like this (per a forum post):But that fails with an error message saying that the json array only supports
labelandvaluekeys.So how exactly does one successfully use a select type with a pre-set value for edit?
thanks!