Pre-select Radio Button based on database data #845
-
We've got a from with several input types, two options have a group of inputs
As a next step we want to enable editing of existing plants and therefore load the form with the plant's data from the database. We currently struggle in changing the default data of the radio buttons to the plant's data load from the database. One idea is to put the whole radio button into a ternary operator e.g.
But maybe there is a smarter, easier solution for it? Branch is: https://github.com/SabinePfanner/plants-app/tree/feature-create-plants |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can use the https://stackblitz.com/edit/vitejs-vite-wkjmey?file=src%2Fmain.jsx,src%2FApp.jsx&terminal=dev Let met know if that helped |
Beta Was this translation helpful? Give feedback.
You can use the
defaultChecked
attribute, here is a simple prototype:https://stackblitz.com/edit/vitejs-vite-wkjmey?file=src%2Fmain.jsx,src%2FApp.jsx&terminal=dev
Let met know if that helped