Skip to content

Commit

Permalink
fix: properly set default value for checkboxes (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Dec 17, 2024
1 parent d5af551 commit 81aa35d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/elements-react/src/components/form/form-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export function computeDefaultValues(nodes: UiNode[]): FormValues {
const attrs = node.attributes

if (isUiNodeInputAttributes(attrs)) {
// TODO: Kratos should return false for the value here, and not undefined.
if (attrs.type === "checkbox" && typeof attrs.value === "undefined") {
attrs.value = false
}
// Skip the "method" field and "submit" button
if (
attrs.name === "method" ||
Expand Down

0 comments on commit 81aa35d

Please sign in to comment.