I have an input field which is only allowed to take a maximum of 6 characters. I know I can use react formal with yup to create a schema that enforces it on validation. However, I'd like the input element to not accept more than 6 characters (like you can do with HTML5's maxlength). Using an alternative form element (setting component to div) doesn't seem to do this either despite there no longer being a novalidate on the parent.
Do you have any suggestions on how to do this? I was wondering if there might also be a onChange or transform approach to prevent the value from changing above 6 characters even after the user types in the field
I have an input field which is only allowed to take a maximum of 6 characters. I know I can use react formal with yup to create a schema that enforces it on validation. However, I'd like the input element to not accept more than 6 characters (like you can do with HTML5's
maxlength
). Using an alternative form element (settingcomponent
todiv
) doesn't seem to do this either despite there no longer being anovalidate
on the parent.Do you have any suggestions on how to do this? I was wondering if there might also be a onChange or transform approach to prevent the value from changing above 6 characters even after the user types in the field