Answers for "how to validate email in useform"

0

how to validate email in useform

const {
    control,
    handleSubmit,
    formState: { errors }
  } = useForm<FormValues>();

  <InputComponent 
	{...otherProps}
    control={control}
    error={errors.email?.message}
    rules={{
        required: 'Enter Email',
        pattern: {
          value: /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
          message: 'Please enter a valid Email'
        }
     }}
  />
Posted by: Guest on August-13-2021

Code answers related to "how to validate email in useform"

Code answers related to "Javascript"

Browse Popular Code Answers by Language