Skip to content

Edit form and select type #984

Answered by lovasoa
jhautefeuille asked this question in Q&A
Discussion options

You must be logged in to vote

The issue is how the form options were written.

You had this:

[{"label": "Demi-journée", "value": "0.5"}]

That "0.5" is a string, not a number. But the database gives back a real number like 0.5, not a string.

So the form couldn’t match them. It was comparing number 0.5 to string "0.5" and those aren’t the same.

The fix:

Write numbers as numbers, not strings:

[{"label": "Demi-journée", "value": 0.5}]

No quotes around the number. Just like you wouldn’t write "1.0" when you mean the number 1.0.

Now the form sees:

  • 0.5 from the DB
  • 0.5 in the options

→ They match. Problem solved.


SELECT 
    'Quotité'                    as name,
    'select'                     as type,
    'Choisir une quo…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jhautefeuille
Comment options

Answer selected by lovasoa
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants