-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Description
I tried this sample code to see why the FieldError did not show up. And surprisingly, it’s because of the InputGroup wrapper. If I bring the FieldControl (Input, NumberField) out of the InputGroup, everything is fine.
<Form validationMode="onChange">
<Field
validate={(value) => {
if (value === undefined || value == null || value === 0) {
return "Amount is required";
}
if (typeof value === "number" && Number.isFinite(value)) {
if (value > 50) {
return "Insufficient balance, your remaining balance is 50.00";
}
if (value < 20) {
return "The minimum amount is 20.00";
}
}
return null;
}}
>
<FieldLabel>Withdrawal amount</FieldLabel>
<InputGroup>
<NumberField required>
<NumberFieldInput placeholder="Maximum [x] per day" />
</NumberField>
</InputGroup>
<FieldError match="customError" />
</Field.Root>
</Form.Root>Metadata
Metadata
Assignees
Labels
No labels