useControl
strange behaviour
#474
-
Describe the bug and the expected behaviorI am using useControl in a DateInput component and mapping the value type from Date to string as Please check the StackBlitz example: I console.log the value of Conform versionv1.0.2 Steps to Reproduce the Bug or Issue
What browsers are you seeing the problem on?Chrome Screenshots or Videos![]() Additional contextIn fact, the same thing happened in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because you are leaving it to mantine to decide how the input is rendered when you provide a <input type="hidden" name="control" value="2026-02-12T23:00:00.000Z"> If you wanna have full control over the value on the input, it would be better to create your own hidden input like this: <input
type="hidden"
ref={control.register}
name={fields.control.name}
defaultValue={control.value}
/>
<DatePickerInput
label="useControl"
placeholder="Pick date"
valueFormat="DD/MM/YYYY"
name={fields.control.name}
value={control.value ? stringToDate(control.value) : null}
onChange={(value) => control.change(value ? dateToString(value) : '')}
error={fields.control.errors}
/> |
Beta Was this translation helpful? Give feedback.
This is because you are leaving it to mantine to decide how the input is rendered when you provide a
name
prop to it. If you inspect the element, you will find this html:If you wanna have full control over the value on the input, it would be better to create your own hidden input like this: