Page 1 of 2
Default values (select type field)
Posted: Mon May 05, 2025 8:09 pm
by uzlander_ya
Hi community! Recently stumbled upon a need to set defaults to (or rather preserve/save the value) in the select field.
Originally the select field gets its value pairs from an sql statement (just pull id|someName from other entities) and as the whole record(row with other fields as well) is saved, navigating to list view i see all the fields there filled as expected but now clicking the row (back to editing) i see all in place except for that select field which is empty. PhpMyAdmin shows the value persisted ok.
First I was thinking about some js workaround to fill the value back on (edit)form load, but probably there should be some more elegant solution to this issue.
Please people help, i'll give screenshots or some more details if needed
Re: Default values (select type field)
Posted: Mon May 05, 2025 9:27 pm
by steven
Hi uzlander_ya,
Can you show us some screenshots?
Steven
Re: Default values (select type field)
Posted: Tue May 06, 2025 7:02 am
by Uzlander
Sure, the screenshot - about the select field sql source, and then - short video
Re: Default values (select type field)
Posted: Tue May 06, 2025 7:56 am
by kev1n
statia
is an object on the form or how is it set?
Re: Default values (select type field)
Posted: Tue May 06, 2025 8:09 am
by Uzlander
'statia' is kindof CATEGORIES option list (radio buttons above) which filters out SUBCATEGORIES (select field, which derives its value list from say 'Categories' table). Its just i saw radio buttons bo be more inuitive/nicer looking to represent top level categories
Re: Default values (select type field)
Posted: Tue May 06, 2025 8:16 am
by kev1n
Ensure that the value of 'statia' is also set for existing records, or save it to a nuBuilder object/table with the ID 'statia', since it appears that the hash cookie does not retain the value when the form is reloaded.
Re: Default values (select type field)
Posted: Tue May 06, 2025 8:30 am
by Uzlander
red underlined field (screenshot) represents the id for each radio button, which in turn filters out my Subcategories select.
On radio change there's a little uneditable field indicating current radio id.
Arranged a bit tangled way sorry))
Re: Default values (select type field)
Posted: Tue May 06, 2025 8:43 am
by kev1n
Would it be possible for you to either export your database (with any confidential data removed) or just share the form using the cloner tool, along with the associated tables?
Re: Default values (select type field)
Posted: Tue May 06, 2025 12:05 pm
by Uzlander
Sure i can export it (all the data is dummy), i believe its Database->Backup generated sql file, shall i attach it below or better to email.. ?
So i reviwed the names/variables i've messed so far (renamed #statia# to #kateg#) brought it to consistency as much as i could.
But my utmost suspicion now is the following:
My radio buttons (representing Categories) are not in the db table, they're kinda just on the frontend to fill out 'kateg' text field(which in turn exists in its underlying db table). And i've configured (by scripting, on edit/add form load) to check the one in accordance to 'kateg' field value existing (there's #kateg# hash of course) or in case of adding new record there's still default one to be checked via javascript, so the the Subcategories select always has some #kateg# to have its list filtered out.
Having observed that upon (Category)radio change the prior selected Subcategory clears(renewing its value list), it seems like my empty select issue is result of that script flawed side effect
Re: Default values (select type field)
Posted: Tue May 06, 2025 12:06 pm
by Uzlander
dump file