You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've included a boolean field in my schema form demo. I would like it to be a "Terms and Conditions" checkbox, where the user is required to check the box before continuing. Making the field a required field does nothing, I assume because false is a value. In order to gain the functionality to require the checkbox to be checked, I added a function to the $validators object. This worked in that the form cannot be processed without the checkbox being checked. However, the user is given no message below the checkbox itself, even though I included a validation message.
Have I missed something? I'd love for the checkbox to get the same validation cues as input fields.
The text was updated successfully, but these errors were encountered:
After further testing, it seems as though the validation message will fire if I check the box and then uncheck it. It will also show the proper error. This still doesn't happen on submit. That is where I need it to happen.
Just for further clarity, I'm not giving the checkbox an initial value, which means it defaults to false (which is what I want).
@TimCorey have you tried using validateOnRender, that would show the error immediately? Failing that can you hide the submit buttons until the checkbox is checked?
@TimCorey I am closing this because technically the attribute you want is { const: true } as part of the schema, this isn't supported in tv4, but making ajv or djv available to validate with is already covered in other issues.
I've included a boolean field in my schema form demo. I would like it to be a "Terms and Conditions" checkbox, where the user is required to check the box before continuing. Making the field a required field does nothing, I assume because false is a value. In order to gain the functionality to require the checkbox to be checked, I added a function to the $validators object. This worked in that the form cannot be processed without the checkbox being checked. However, the user is given no message below the checkbox itself, even though I included a validation message.
Have I missed something? I'd love for the checkbox to get the same validation cues as input fields.
The text was updated successfully, but these errors were encountered: