yup Questions

2

Solved

If I had a property that should be limited to only a few possible values, using Yup I could do something like: prop: Yup.string().oneOf([5, 10, 15]) I can not seem to find something similar in Zod...
Nigeria asked 26/12, 2022 at 14:56

3

Solved

Problem I have a formik form which needs to have 2 different validation schemas depending on what button the user uses to submit. I have seen some people say use state to decide which one but I wan...
Lukasz asked 20/8, 2022 at 8:20

3

I've three fields : referenceMonth(string), openingDate(string), closingDate(string) in Formik form. I would add an error to openingDate when openingDat isn't the same month as referenceMonth. expo...
Agle asked 2/4, 2021 at 9:49

3

Solved

I just trying to create a custom Formik <Field />. It is a <input type = file /> with opacity=0 and depending of values i styling my <Error /> component and <input type = text ...
Demiurge asked 5/7, 2020 at 9:48

7

I have a MUIRadioGroup (options = Low, Medium and High) and a multi-select MUIAutocomplete component on my form. <MUIRadioGroup name="requestDetail.riskAssesmentDetail.riskClassification&q...
Transformer asked 24/2, 2023 at 7:38

8

Solved

I have form with dynamic amount of inputs (admin email) however checking for uniqueness fails: validationSchema={Yup.object().shape({ adminEmails: Yup.array() .of( Yup.string() .notOneOf(Yup...
Forgo asked 8/1, 2019 at 14:27

7

I'm using Yup to validate my form. In one of my form, I want to validate that one <input type="file" /> has a file. I've tested this (and it's not working): Yup.object().shape({ file: Yup....
Regine asked 20/9, 2018 at 14:8

7

Solved

I'm working with a react form validation using Yup along with Formik. There is a react-select element in the form which needs to be validated as well. For validation i'm making use of validationSch...
Manure asked 21/8, 2019 at 14:38

3

I'm currently converting a piece of code to TypeScript and running into a few type issues with yup types. I've tried multiple ways and referenced yup's documentation on TypeScript support to tackle...
Zinovievsk asked 12/2, 2021 at 11:38

3

Solved

I'm working on a simple file upload form using react-hook-form and I need to validate that a file has been selected for upload. Using yup for validation. I realize there are other questions on this...
Wormy asked 19/2, 2022 at 21:53

3

I'm using yup module for validate my form. I would like access to parent for test the value. My schema : enabled: yup.boolean(), contactDetail: yup.object().shape({ phoneNumber1: yup.string().n...
Tory asked 14/5, 2019 at 8:12

4

Solved

Pretty new with Formik, I have a simple form, which has validation. I need to have 2 buttons, Submit and a Save button which will mostly do the same thing, however, if "Save" button is clicked, I w...
Carlson asked 12/5, 2020 at 10:22

3

Solved

I'm using react-hook-form with yup for my form validation and want some fields to be optional (null). Following their documentation, I'm using nullable() and optional() but it is still getting vali...
Leucas asked 26/5, 2022 at 9:42

5

Solved

I use react-hook-form with yup to validate my forms. I want to know all required fields of a schema to display some information in form (like '*' for required fields). We could achieve this with th...
Swerve asked 20/10, 2020 at 7:26

3

Solved

I am trying to create a yup schema where based on a variables value the schema changes slightly. In my case depending on the value of prop myCondition I need to make a field as required. I would li...
Adornment asked 6/4, 2020 at 16:20

7

I have a form using reactjs + formik + yup. I have a multi file upload field. I want to validate the file format and max size using yup. How can I do this?
Pryor asked 3/1, 2019 at 10:43

7

Solved

Is it possible to validate a field only when it exists? I'm going to create an application. A field(email) may / may not display on step 2, it depends on the step 1's selected option. The problem i...
Plangent asked 7/1, 2021 at 13:48

2

Solved

I have an onChange function onNameChange that contains a valid variable that should match the yup validation of the name field. The problem is that the valid variable only seems to be correct after...
Peppy asked 30/7, 2021 at 11:33

8

Solved

I am rendering a custom component using the Controller of react-hook-form. If an error occurs when using register, focus is normal, but the Controller does not. I was able to find a way to handle a...
Dislocate asked 26/10, 2021 at 8:12

4

Solved

I'm using Yup.js to validate some form fields. I have two integer fields, Year Built & Year Renovated. Year Built is a required field, Year Renovated is not. Year renovated can be left blan...
Stableman asked 7/5, 2020 at 15:29

2

Solved

In my Yup schema I was my String field name to allow you to pass in any string, an empty string, or nothing at all. If you pass in a string, it passes. If you pass in an empty string or nothing, I ...
Quarterdeck asked 25/6, 2021 at 19:58

4

I have a react formik form, where there is a select field, say the field has values A,B,C,D,E,F. now say, another field , ChooseSubType , only shows up if I choose B or D and this field will only ...
Nephritic asked 11/11, 2018 at 4:18

3

Generally <TextInput> allows you to type even when you're just specifying a placeholder. However, when using within the Formik form, I am unable to type and validate anything in my form. What...
Roadhouse asked 8/5, 2020 at 23:26

7

Solved

import * as Yup from 'yup'; import User from '../models/User'; class UserController { async store(req, res) { const schema = Yup.object().shape({ name: Yup.string().required(), email: Yup.string...
Zagazig asked 18/5, 2020 at 4:2

2

Solved

I have the following yup check: nrOfApples: yup.number().min(0).max(999), And right now if I leave the field blank, it validates as false. Is there any way to make yup.number() accept empty values...
Aquamarine asked 3/8, 2020 at 13:36

© 2022 - 2024 — McMap. All rights reserved.