yup Questions
1
I'm trying to use Yup to define a schema and generate a Typescript Type that I can use for my objects.
Using InferType seems to work fine for strings and objects, but there's unexpected behavior fo...
Idolism asked 22/1, 2021 at 22:33
3
Solved
I have a schema:
const SignupSchema = Yup.object().shape({
decimal: Yup.number().integer('invalid decimal'),
});
I need to check if the number is a decimal, but I found only Integer in docs.
Savitt asked 10/12, 2019 at 14:44
2
I'm working with yup validation and trying to build a conditional validation object.
My question is, How do I add the required and match objects to the Yup.string() object without hard coding it. ...
Hartal asked 23/10, 2018 at 5:35
1
Solved
How to change message text for date field:
date must be a date type, but the final value was: Invalid Date
Now scheema looks like this:
let scheema= yup.object().shape({
date: yup.date()
.min(M...
Alexi asked 14/7, 2022 at 18:41
1
Solved
I have what I thought was a simple validation using oneOf that isn't working for me with yup:
const schema = Yup.mixed()
.oneOf([
{
error: `EmailOrPasswordInvalid`,
},
{},
])
.required();
....
Samsara asked 9/7, 2022 at 23:33
2
Solved
I want to make sure users don't fill in their username (pattern is a upercase or lowercase u, followed by 7-10 digits: U0000000)
In the following example, the regex itself does work. However in co...
Parthenopaeus asked 10/12, 2019 at 13:35
1
I'm trying to validate a number field that is optional, and therefore allowed to be empty. If there is a value in the field, it must be a positive number.
const schema = yup.object().shape({
gpa: ...
Stubbed asked 19/10, 2021 at 0:46
2
I'm using yup to create validations for my data , how can i handle enums?
this is a sample of my validations - I'm using object.shape method of the yup:
export const deleteCityValidation = yup.ob...
Jahn asked 21/1, 2020 at 7:27
4
I am trying to implement login functionality using Formik and Yup. This is my current schema
let loginSchema = yup.object().shape({loginId:
yup
.string()
.email("That doesn't look like a valid e...
Perform asked 15/5, 2020 at 8:14
5
I am trying to create some custom error messages with Yup to determine if the user's email address is in use.
I have created the following promise to try and catch a server communication error:
....
Hunkers asked 10/2, 2020 at 16:50
1
Yup is returning always one error in the array even though all fields are valid. The validation is working fine, is checking each field and showing the errors correctly. The form state and the vali...
Musketry asked 11/12, 2021 at 14:41
2
Solved
I am currently stuck on how to do validation with yup for same date.
Currently I am able to validate if endDate is not before startDate using :
schema = yup.object().shape({
startDate: yup.date()....
Frequentative asked 16/11, 2021 at 7:12
8
Solved
const validationSchema = Yup.object().shape({
newPassword: Yup.string().min(8, 'Password must be at least 8 characters');
});
I want to validation check only if newPassword field is not empty.
Ho...
Hus asked 3/6, 2020 at 8:55
5
I have a react app that uses Formik for forms and Cloud Firestore for the database.
I am trying to save the form data in Cloud Firestore. I get no errors in my console or react inspector tools, an...
Culpepper asked 16/5, 2019 at 23:26
3
Solved
I have a Formik form in react native and a Yup validationSchema. When user submits form I want to create an alert with the error fields if there are fields that are invalid.
Dependencies:
"formik"...
Fabricate asked 11/1, 2019 at 10:16
1
I using Yup with react-hook-form and have the following schema in Yup
const validationSchema = Yup.object({
installation: Yup.string().nullable().required("Required"),
from_date: Yup.d...
Sigmatism asked 8/5, 2021 at 15:24
4
Solved
I have the follow Yup configuration in my React app:
const schema = yup.object().shape({
email: yup.string()
.email('E-mail is not valid!')
.required('E-mail is required!'),
password: yup.str...
Analysand asked 9/2, 2020 at 11:53
1
im struggling to create a typescript interface for a yup schema (https://github.com/jquense/yup/blob/master/docs/typescript.md)
given the typescript interface:
interface TestInterface {
name: stri...
Indecent asked 12/7, 2021 at 12:12
2
Solved
I am trying to make a password validation using yup where at least 3 of 4 password conditions are met. I am having trouble finding an existing way to do this.
My requirements are this:
At least 8 ...
Longford asked 10/1, 2021 at 19:52
2
Solved
I am working with multiple forms . In some cases the forms having similar fields eg, name , phone number , account number etc.., . I am using formik as well . I have created schema file (schema.js)...
Node asked 6/5, 2021 at 7:26
2
Solved
I'm trying to use Yup along with Formik in my react form. The form fields are going to be dynamic so as their validations.
export const formData = [
{
id: "name",
label: "Full name",
placehol...
Daniels asked 23/6, 2019 at 15:35
4
interface FormValues {
friendEmail: string;
}
const initialValues: FormValues = {
friendEmail: '',
};
export const Page: React.FunctionComponent<PageProps> = ({
toggleShowPage,
showPa...
Hepatic asked 7/5, 2020 at 13:9
0
For a project I use yup but I am having problems getting a good type from the schema ... Ideally I'd get a Type that shows when a Property has a certain Value, another property has to be defined!
I...
Frond asked 16/2, 2022 at 8:18
1
Solved
EDIT: while the accepted solution worked, this worked much better in my use case
I have one function that validates that neither input field A nor input field B are empty
and with the way my form i...
Hamman asked 13/8, 2021 at 19:16
2
I am trying to use Yup with Formik for my user profile screen. The validation works fine but it expects the format of the date entered by the user to be in USA format MM/DD/YYYY rather than the app...
Heist asked 11/2, 2021 at 13:5
© 2022 - 2024 — McMap. All rights reserved.