Client Side browser default 'required' addition #102
-
Hi team, I have been in the process of adding this to my forms as it will standardise the phone number inputs across the application. Problem is in a few of my forms we rely on the browser default required on our main form to help progress users through inputs they missed, and while you have validation it skips by the browser default and creates a different behaviour. What is possibility of passing required as an option for those that want to opt in? At the moment I am stuck between having to rip out the work I have done, or remove the browser default and implement a totally custom solution. Kind regards Cooper PS: this is a fantastic tool |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@CoopsCodes Hey! <PhoneInput
defaultCountry="us"
value={phone}
onChange={setPhone}
inputProps={{
required: true,
}}
/> |
Beta Was this translation helpful? Give feedback.
apologies, I have just seen it will work if the input is totally empty as such
But it will not recognise it if the area code is in the input.
Now I know this I can try with with it, this is an interesting behaviour but I guess from the browser's point of view, it isnt technically empty, I might need to put some minimum browser validation like
min="8"
etc just to grab this.Again, thank you for your help.