I have an input that requires the user to input their phone number. However, the user can currently input letters and still submit the form. It seems that the type="tel" attribute on the input doesn't do anything. How do I solve this?
<FormControl
isRequired
isInvalid={touched.number && !values.number}
mb={2}
width='100%'
>
<FormLabel fontSize='lg' fontFamily='Proxima Nova' fontWeight='500'>
Phone number
</FormLabel>
<Input
type='tel'
name='number'
h={10}
borderColor='#24392E'
errorBorderColor='#ef5350'
placeholder='Phone number'
value={values.number}
onChange={handleChange}
onBlur={onBlur}
_hover={{
borderColor: '#7fa87f',
}}
/>
<FormErrorMessage>Required</FormErrorMessage>
</FormControl>
Not the most elegant solution BUT you can try the following: