-
Hi, Thank you very much for this project. It allows me to create a small app for a non-profit organisation with a minimal budget. I have a special problem I cannot deal with, maybe someone here has already faced it. It is pretty simple to explain: I have a form defined like that
As the input name is from db, I don't know how to retrieve it to build my INSERT query in the insert.sql Is there a way to query the POST parameters received? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
That's a good question, and that makes me realize we don't have a good documentation for dynamic fields. I added an example to the repo for precisely this use case: https://github.com/lovasoa/SQLpage/tree/main/examples/forms%20with%20a%20variable%20number%20of%20fields Let me know if it answers your question. |
Beta Was this translation helpful? Give feedback.
-
As a note if someone stumbles on this thread now: SQLPage v0.15 will introduce a new select 'form' as component, 'handle_survey_answer.sql' as action;
select question_id as name, question_text as label from survey_questions; and then handling the results: insert into survey_answers(question_id, answer)
select "key", "value" from json_each(sqlpage.variables('post')) Of course, it is still possible to use the square brackets syntax. I would recommend using:
|
Beta Was this translation helpful? Give feedback.
That's a good question, and that makes me realize we don't have a good documentation for dynamic fields.
I added an example to the repo for precisely this use case: https://github.com/lovasoa/SQLpage/tree/main/examples/forms%20with%20a%20variable%20number%20of%20fields
Let me know if it answers your question.