Skip to content

Commit

Permalink
fix: properly set default value for checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Dec 17, 2024
1 parent 071c0ff commit 43a1be9
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

Check warning on line 14 in packages/elements-react/src/components/form/form-helpers.ts

View check run for this annotation

Codecov / codecov/patch

packages/elements-react/src/components/form/form-helpers.ts#L14

Added line #L14 was not covered by tests
}
// Skip the "method" field and "submit" button
if (
attrs.name === "method" ||
Expand Down

0 comments on commit 43a1be9

Please sign in to comment.