H0H0H0 tralalalala
This commit is contained in:
parent
7df82c4616
commit
d3bc94a62a
@ -8,7 +8,7 @@ export default function App() {
|
|||||||
/* "handleSubmit" will validate your inputs before invoking "onSubmit" */
|
/* "handleSubmit" will validate your inputs before invoking "onSubmit" */
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="Contact">
|
<div className="Contact">
|
||||||
<h1>Contacter-nous!</h1>
|
<h1>Contactez-nous!</h1>
|
||||||
<div className="Error_color">
|
<div className="Error_color">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -202,12 +202,13 @@ export default function App() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>Code postal*: </label>
|
<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}
|
value={currentAdress.postalCode}
|
||||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, postalCode: e.target.value } })} />
|
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, postalCode: e.target.value } })} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{errors.postalCode && errors.postalCode.type === 'required' && <span>Vous devez entrer votre code postal!</span>}
|
{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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -207,11 +207,12 @@ const MyAddresses = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>Code postal*: </label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
{errors.postalCode && errors.postalCode.type === 'required' && <span>Vous devez entrer votre code postal!</span>}
|
{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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user