yup Questions

3

Solved

tsconfig.json { "compilerOptions": { "sourceMap": true, "outDir": "dist", "target": "es5", "lib": ["es6", "...
Sight asked 1/11, 2022 at 15:0

3

I'm using Yup to validate a signup form but I'm struggling to validate the credit card fields due to needing methods from both Yup's string and number schema. Card number for example should not ex...
Gnomon asked 8/6, 2018 at 10:35

3

Solved

I'm having difficulty updating some old ReactJs code written in version 16 to 18, along with the Yup package also being updated (0.26.6 -> 1.2.0), as it seems some of the syntax rules for this w...
Saturant asked 14/6, 2023 at 13:18

5

I have this piece of a code. I want to add error messages depending on user's locale, but yup throws errors, same if fields are filled in incorrectly [missing "en.login.emailRequiredError" transla...
Ecosystem asked 20/3, 2018 at 16:14

2

Solved

I'm using react-hook-form and yup together and for some reason it's displaying the wrong error message. When the phone number input is left empty on submitting the form, it displays the typeError e...
Destrier asked 6/10, 2021 at 6:45

3

I'm using formik with yup to treat my forms and i need to validate two objects that is setted by formik in initial values: initialValues: { company: { company_name: '', cnpj: '', fantasy_name: ''...
Hounding asked 3/3, 2020 at 17:45

4

Solved

I am new to React and was trying out formik with yup for the validation. I am currently getting the error below: TypeError: Cannot read property 'object' of undefined with this code: validati...
Laminated asked 8/6, 2018 at 5:20

7

Solved

I have a form that creates an event using Formik library. I need to check to see if the start date overlaps the end date and vice-versa. I have two date pickers that choose the date and time. How c...
Sadfaced asked 11/11, 2019 at 23:44

11

Solved

I'm trying to validate a phone number with Yup: phone: Yup.number() .typeError("That doesn't look like a phone number") .positive("A phone number can't start with a minus") .integer("A phone nu...
Obtund asked 24/9, 2018 at 16:4

6

Solved

how would one go about having password validation but at the same time having the errors be passed to different variables? i.e password: Yup.string().required("Please provide a valid password")...
Hildebrand asked 27/3, 2018 at 0:1

11

I have an email field that only gets shown if a checkbox is selected (boolean value is true). When the form get submitted, I only what this field to be required if the checkbox is checked (boolean ...
Aurelioaurelius asked 20/3, 2018 at 21:27

8

Solved

I want to validate my form using yup in formik. Suppose I have 4 fields A, B, C, D and they are all strings. How should I write the validation schema if I want to have at least one of the fields is...
Fane asked 10/9, 2019 at 3:57

3

I have this schema in Yup that puts a minimum date constraint on the date field: Yup.date() .required(strings.RequiredField(strings.Invoice_Label_DueDate)) .min(new Date(), "Date cannot be in th...
Maurist asked 28/2, 2019 at 2:47

17

Solved

Is there a yup function that validates a specific length? I tried .min(5) and .max(5), but I want something that ensures the number is exactly 5 characters (ie, zip code).
Sublunar asked 17/4, 2018 at 20:24

3

Solved

Most answers I have seen customize yup validation messages when defining a schema, e.g. const personSchema = yup.object().shape({ firstName: yup.string().required('First name is a required field')...
yup
Bricker asked 26/12, 2020 at 19:0

2

Solved

yup package Issue When a custom method added to yup instance using the addMethod function, It produces the error below TS2339: Property 'title' does not exist on type 'typeof import("node_modu...
Devondevona asked 14/9, 2021 at 10:47

9

Solved

I am trying to validate an input field as a website using yup.string().url() But it seems if the protocol is not sent it gives an error, when the website should be flexible to even accept for exam...
Quaky asked 6/5, 2020 at 12:15

3

Solved

I have a JSON object which contains an array of JSON objects. My need is out of 2 array elements (vehicles), I just need to ensure that at least one is filled with data i.e. both can't be empty.. s...
Petcock asked 22/8, 2020 at 9:34

4

So, I recently upgraded "yup": "^0.29.1" => "yup": "^0.32.11" "@types/yup": "^0.29.3" => "@types/yup": "^0.29.13&qu...
Spencerspencerian asked 16/3, 2022 at 16:28

6

I have a data structure like this: { "subject": "Ah yeah", "description": "Jeg siger...", "daysOfWeek": [ { "dayOfWeek": "MONDAY", "checked": false }, { "dayOfWeek": "TUESDAY", "checked"...
Hawker asked 5/12, 2019 at 14:41

2

Solved

I'm working on a registration form made with yup, react-hook-form and Material UI DatePicker/TextField. I'd like to have a date of birth field that checks if the user is above 18 years old. The err...
Lacto asked 8/1, 2022 at 16:49

2

const {values, handleChange, handleSubmit, errors} = useFormik({ initialValues: { name: '', address: '', latitude: '', longitude: '', nit: '', category: '', email: '', }, validationSchema...
Candelabra asked 5/12, 2022 at 21:15

2

Solved

I'm working on an Ionic React App and I want to use React Hook Form and Yup Resolvers for submitting a form . My form contains a radio button and two other inputs. I'm facing difficulties with the ...
Fulminous asked 7/5, 2021 at 12:57

5

Solved

I would like to conditionally display errors in my form. The way formik works is that if you change one field all validations are ran and all errors returned even thought you changed just one. I ...
Grume asked 10/9, 2018 at 12:41

5

Solved

I am using a Formik React Form and Yup validation defined on a schema: export const Contact = yup.object<IContact>().shape({ contactName: yup .string() .trim('The contact name cannot incl...
Pak asked 26/2, 2020 at 22:13

© 2022 - 2024 — McMap. All rights reserved.