H0H0H0 tralalalala

This commit is contained in:
DavidBelisle 2022-11-12 08:11:53 -05:00
parent 7df82c4616
commit d3bc94a62a
3 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ export default function App() {
/* "handleSubmit" will validate your inputs before invoking "onSubmit" */
<form onSubmit={handleSubmit(onSubmit)}>
<div className="Contact">
<h1>Contacter-nous!</h1>
<h1>Contactez-nous!</h1>
<div className="Error_color">
<div>
<div>

View File

@ -202,12 +202,13 @@ export default function App() {
</div>
<div className="form-group">
<label>Code postal*: </label>
<input {...register("postalCode", { required: true })}
<input {...register("postalCode", { required: true, pattern: /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i })}
value={currentAdress.postalCode}
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, postalCode: e.target.value } })} />
</div>
<div>
{errors.postalCode && errors.postalCode.type === 'required' && <span>Vous devez entrer votre code postal!</span>}
{errors.postalCode && errors.postalCode.type === 'pattern' && <span>Veuillez entrer un code postal valide!</span>}
</div>
</div>

View File

@ -207,11 +207,12 @@ const MyAddresses = () => {
</div>
<div className="form-group">
<label>Code postal*: </label>
<input {...register("postalCode", { required: true })}
<input {...register("postalCode", { required: true, pattern: /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i })}
/>
</div>
<div>
{errors.postalCode && errors.postalCode.type === 'required' && <span>Vous devez entrer votre code postal!</span>}
{errors.postalCode && errors.postalCode.type === 'pattern' && <span>Veuillez entrer un code postal valide!</span>}
</div>
</div>