Show error message for hidden field #298
-
Hi everyone! I have a custom select component which has a hidden input for storing selected item(s) value(s). I passed // custom select comp
<Select
{...conform.input(coverageId)}
...
/>
{!!coverageId.error && coverageId.error}
// internal hidden input
<input
type="hidden"
name={name}
form={form}
required={required}
value={selectedId}
/> The problem i'm facing is that when i submit the form with no value for this field, the error message is not displayed. Is there any way i could get and display the error message ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Conform utilizes Constraint Validation APIs such as setCustomValidity to propagate the error messages at the moment. But the element might be barred from constraint validation on certain conditions. For example, the browser does not report error from If you have control over the input element, please use |
Beta Was this translation helpful? Give feedback.
Conform utilizes Constraint Validation APIs such as setCustomValidity to propagate the error messages at the moment. But the element might be barred from constraint validation on certain conditions. For example, the browser does not report error from
disabled
or hidden type input which is the issue you had.If you have control over the input element, please use
<input hidden>
instead.