create_new and Multi-Step Form #1002
Replies: 4 comments 3 replies
-
Hello and welcome to SQLPage ! Could you please create a minimal reproduction of your issue ? Ideally a single self-contained sql file that clearly reproduces your issue without any unrelated code. |
Beta Was this translation helpful? Give feedback.
-
And if I may give a suggestion: you probably should split your form into multiple steps, on different screens. No more than a handful of fields should be displayed at the same time. |
Beta Was this translation helpful? Give feedback.
-
Hi @EdbertoLima ! Ok, I had a look at your code. select 'form' as component;
select
'select' as type,
true as create_new,
true as dropdown,
'2' as value,
'[{"label": "A", "value": 1}, {"label": "B", "value": 2}]' as options; The problem is that the value in The best solution in your case is probably to pass option values as strings too: SELECT
'site_name' AS name,
'Site Name' AS label,
'select' AS type,
TRUE as create_new,
TRUE AS dropdown,
TRUE AS required,
'Type the Site Name' as empty_option,
3 AS width,
NOT ($action IN ('Edit', 'INSERT')) AS disabled,
$site_loc_name AS value,
(SELECT json_agg(json_build_object('label', loc_name, 'value', id::text) ORDER BY loc_name) FROM temp_site) AS options; In the future, I encourage you to try and create a minimal reproduction of your issues ! Not only does it make easier for others to help you, but it often makes the problem so obvious that you can solve it yourself ! |
Beta Was this translation helpful? Give feedback.
-
I updated the form component to avoid this footgun. Starting with v0.37, the SQLPage form component will consider numbers and their string representation as equal when comparing the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I am developing a system for entering scientific experiments using SQL pages, and I have been struggling to find a solution to one issue I am facing. I have a multi-step form where the user can select the number of operations and click next, and the form displays as many fields as necessary. The problem is that when we press next, the element of one of my fields, which is a select type and create_new is TRUE, gets set to null, and I have to re-type to continue to the next page.
If someone has an opinion or could help me find a solution, I would appreciate it.
register_field.sql
form_site.sql
insert the var

After press next

Beta Was this translation helpful? Give feedback.
All reactions