web:javascript:react:yup
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédenteDernière révisionLes deux révisions suivantes | ||
web:javascript:react:yup [2019/08/30 23:14] – créée sgariepy | web:javascript:react:yup [2019/08/30 23:19] – [phone] sgariepy | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== yup ====== | ====== yup ====== | ||
+ | |||
+ | |||
+ | ===== email ===== | ||
+ | |||
+ | < | ||
+ | email: Yup.string() | ||
+ | .email(' | ||
+ | .required(' | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== adresse ===== | ||
+ | |||
+ | < | ||
+ | address: yup.string().required(' | ||
+ | city: yup.string().required(' | ||
+ | region: yup.string().required(' | ||
+ | country: yup.string().required(' | ||
+ | postalCode: yup | ||
+ | .string() | ||
+ | .when(' | ||
+ | is: ' | ||
+ | then: yup.string().matches(/ | ||
+ | }) | ||
+ | .when(' | ||
+ | is: ' | ||
+ | then: yup.string().matches(/ | ||
+ | }) | ||
+ | .required(), | ||
+ | </ | ||
Ligne 11: | Ligne 42: | ||
+ | Plus spécifiquement pour le format de différents pays: | ||
+ | < | ||
+ | |||
+ | phone: yup | ||
+ | .string() | ||
+ | .when(' | ||
+ | is: country => [" | ||
+ | then: yup.string().matches(/ | ||
+ | }) | ||
+ | .required(), | ||
+ | </ | ||
===== password ===== | ===== password ===== | ||
+ | |||
+ | < | ||
+ | password: Yup.string() | ||
+ | .min(6, ' | ||
+ | .required(' | ||
+ | passwordConfirmation: | ||
+ | .oneOf([values.password], | ||
+ | .required(' | ||
+ | </ | ||
+ | |||
+ | ===== Consent ===== | ||
+ | |||
+ | |||
+ | < | ||
+ | consent: Yup.bool() | ||
+ | .test( | ||
+ | ' | ||
+ | '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.txt · Dernière modification : 2022/02/02 00:42 de 127.0.0.1