Closed castlekaybee closed 3 days ago
this is the result from the query to the server:
SELECT
AG_ID AS id,
Aggregat AS label
FROM
AbfrageAggregatsListe
FOR JSON AUTO;
[{"id":4,"label":"AN-TB-411"},{"id":6,"label":"PF-TB-559"},{"id":7,"label":"FD-leer-482"},{"id":8,"label":"FD-leer-482"},{"id":9,"label":"FD-leer-492"},{"id":10,"label":"FD-leer-492"},{"id":11,"label":"FD-leer-582"},{"id":12,"label":"FD-leer-592"},{"id":13,"label":"FD-leer-852"},{"id":14,"label":"FD-leer-862"},{"id":15,"label":"BA-B-524"},{"id":16,"label":"BA-B-525"},{"id":17,"label":"BA-B-526"},{"id":18,"label":"BA-B-527"},{"id":19,"label":"BA-S-524"},{"id":20,"label":"BA-S-525"},{"id":21,"label":"BA-S-526"},{"id":22,"label":"BA-S-527"},{"id":23,"label":"BA-VT-520"},{"id":24,"label":"BA-VT-521"},
...,
{"id":264,"label":"RS-874"},{"id":265,"label":"VQ-875"},{"id":266,"label":"FC-876"},{"id":267,"label":"SC-117"},{},{},{}]
Hello !
I am really sorry, it's my previous answer in https://github.com/lovasoa/SQLpage/discussions/480 that contained an error.
As stated in the documentation, the accepted keys in the json objects of the options
property of the form component are :
label
: the user-friendly name of the option to displayvalue
: the value to transmit to the target page, that you can then access using the :name
syntax.selected
: whether or not the option should be selected by default when the page is loaded.(there is no id
, contrarily to what my previous answer suggested)
So you query should look like this instead:
SELECT 'Aggregatstyp' AS name,
1 AS required ,
'select' as type,
(SELECT
AG_ID AS value, -- value, not id
Aggregat AS label
FROM
AbfrageAggregatsListe
FOR JSON AUTO) as options;
Thanks for spotting this. Now it works as expected 👍
Introduction
in a form component, using a select type (dropdown) with the name property (e.g. mySeleectedValue)
after form submisson the value identified by the name property is empty (:mySelectedValue)
To Reproduce
To test the submitted data:
This works as expected:
This does not submit a value for 'Aggregatstyp':
Version information