Outils pour utilisateurs

Outils du site


web:javascript:react:yup

Ceci est une ancienne révision du document !


Table des matières

yup

email

    email: Yup.string()
      .email('E-mail is not valid!')
      .required('E-mail is required!'),

phone

const phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/

phoneNumber: Yup.string().matches(phoneRegExp, 'Phone number is not valid')

password

    password: Yup.string()
      .min(6, 'Password has to be longer than 6 characters!')
      .required('Password is required!'),
    passwordConfirmation: Yup.string()
      .oneOf([values.password], 'Passwords are not the same!')
      .required('Password confirmation is required!'),
    consent: Yup.bool()
      .test(
        'consent',
        'You have to agree with our Terms and Conditions!',
        value => value === true
      )
      .required(
        'You have to agree with our Terms and Conditions!'
      ),
web/javascript/react/yup.1567199773.txt.gz · Dernière modification : 2022/02/02 00:43 (modification externe)