Url validation doesn't seem to work?
Closed this issue · 2 comments
hypergig commented
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
When using
<TextFieldElement
autoComplete="off"
fullWidth
label="Url"
name="url"
type="url"
required
variant="standard"
/>
Url validation doesn't seem to occur
Expected behavior 🤔
I would expect to see a validation error with helper text saying "Url is not valid"
Steps to reproduce 🕹
Steps:
- Add provided
TextFieldElement
- Enter an invalid url string
- Submit
sadik-malik commented
@hypergig react-hook-form-mui doesn't add a url validation when you specify the type="url" for input field. Try adding a validation using the validation prop.
validation={{
pattern: {
value: /^(https?):\/\/[^\s/$.?#].[^\s]*$/,
message: 'Please enter a valid url',
},
}}
dohomi commented
this is changed in v7 beta and rules
property is providing this functionality