Open
Description
Screen.Recording.2025-02-27.at.10.31.59.mov
Hi, I would like to know if my redirect implementation in the form component with dynamic options is correct. In the attached video, you can see that when I abort the form submission, I get redirected to handle_redirect.sql. Is this expected behavior, or could this be a bug?
thank you
see live https://coolbreeze.org/
select 'form' as component,
TRUE as auto_submit;
'handle_redirect.sql' as action; -- This is where the form submits
select
'selected_country' as name,
'select' as type,
(
SELECT COALESCE(
(SELECT translation_value FROM language
WHERE language_code = $lang
AND translation_key = 'country.form_label'),
(SELECT translation_value FROM language
WHERE language_code = 'en'
AND translation_key = 'country.form_label')
)
) as label,
'options_source.sql' as options_source,
TRUE as searchable;
-- handle_redirect.sql
select 'redirect' as component,
-- Use the selected URL from the form submission
COALESCE(:selected_country, 'index.sql') as link;
-- options_source.sql
select 'json' as component;
set sahaj_links = sqlpage.fetch('https://amrutasahajmaterials.amruta.org/map_json/sahaj_links.json');
select
json_extract(value, '$.url') as value,
CASE
WHEN json_extract(value, '$.native_country_name') = json_extract(value, '$.country_name')
THEN json_extract(value, '$.country_name') || ' ⤿ ' || json_extract(value, '$.clean_url')
ELSE json_extract(value, '$.native_country_name') || ' (' || json_extract(value, '$.country_name') || ')' || ' ⤿ ' || json_extract(value, '$.clean_url')
END as label
from json_each($sahaj_links->'links')
where lower(json_extract(value, '$.country_name')) like '%' || lower($search) || '%'
or lower(json_extract(value, '$.native_country_name')) like '%' || lower($search) || '%';