Skip to content
Advertisement

Tag: yup

Fields in Formik (validated on Yup) are constantly displaying an error as if they are empty or invalid. find codesandbox-link attached below

//The onChange variable in the fields is updated on the above code. I am unable to find the solution towards making the below fields function properly. I tried using formik’s setFieldValue however It didn’t work The below code is the return function: Sandbox Answer Simply use Formik’s handleChange event and values. You don’t need to create custom functions or states

Perform function after form validation

I am using react, typescript, and Email JS library. I am using the react-hook-form library and yup to validate forms. I have worked out the validation and sending the email, but I am unable to do both these functions together. When a user submits the form, I want the “sendEmail” function to be called if the “handleSubmit(onSubmit)” function which validates

start and end date should be different for one year

Hi there I’m using Yup as a validator for one of my schemas This is my code here for validating schema This works but I can add the same date for the start date and end date. I want that end date to be different and higher than start date Thanks a lot Answer You can try Yup.when to handle

Validating not required form fields with Yup?

I want to validate a not required form field with Yup lastname: Yup.string.nullable().notRequired(). I don’t how to proceed further because I have multiple condition to validate the field if the input was given. My validation condition are: Should contain only alphabets. Should be atleast minimum 2 and maximum 20 alphabets. Answer You should use similar match pattern you already have

Advertisement