Hello,
I am facing an issue with my custom registration form. Basically when someone add his password, name, first name etc. it will created an account. But the thing is that, if he go again in the registration form and put the same email he can go on the next steps.
Here is my code :
- Here you have the code that will create an account
import wixUsers from 'wix-users';
$w.onReady(function () {
$w('#submit').onClick( () => {
let emails = [];
let labels = [];
emails.push($w('#email').value);
// register as member using form data
wixUsers.register($w('#email').value, $w('#password').value, {
"contactInfo": {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
"emails": emails,
"labels": labels,
}
});
});
});
$w.onReady(function () {
$w('#submit2').onClick( () => {
let emails = [];
let labels = [];
emails.push($w('#email2').value);
// register as member using form data
wixUsers.register($w('#email2').value, $w('#password2').value, {
"contactInfo": {
"firstName": $w('#firstName2').value,
"lastName": $w('#lastName2').value,
"emails": emails,
"labels": labels,
}
});
});
});
- Here is the code when we click the submit button, it will hide the registration form and make appear the next step of the form :
export function submit_click(event) {
if($w("#firstName").value && $w("#lastName").value && $w("#email").value && $w("#phone").value && $w("#password").value && $w("#checkbox46").checked && $w("#checkbox47").checked) {
$w('#creationcompte').hide();
$w('#typedecontrat').show();
}
else {
if(!$w("#firstName").value) {$w("#firstName").updateValidityIndication()}
if(!$w("#lastName").value) {$w("#lastName").updateValidityIndication()}
if(!$w("#email").value) {$w("#email").updateValidityIndication()}
if(!$w("#phone").value) {$w("#phone").updateValidityIndication()}
if(!$w("#password").value) {$w("#password").updateValidityIndication()
if(!$w("#checkbox46").checked) {$w("#checkbox46").updateValidityIndication()}
if(!$w("#checkbox47").checked) {$w("#checkbox47").updateValidityIndication()}}
}
}
export function submit2_click(event) {
if($w("#firstName2").value && $w("#lastName2").value && $w("#email2").value && $w("#phone2").value && $w("#password2").value && $w("#checkbox44").checked && $w("#checkbox45").checked) {
$w('#creationcompte2').hide();
$w('#typedecontrat2').show();
}
else {
if(!$w("#firstName2").value) {$w("#firstName2").updateValidityIndication()}
if(!$w("#lastName2").value) {$w("#lastName2").updateValidityIndication()}
if(!$w("#email2").value) {$w("#email2").updateValidityIndication()}
if(!$w("#phone2").value) {$w("#phone2").updateValidityIndication()}
if(!$w("#password2").value) {$w("#password2").updateValidityIndication()
if(!$w("#checkbox44").checked) {$w("#checkbox44").updateValidityIndication()}
if(!$w("#checkbox45").checked) {$w("#checkbox45").updateValidityIndication()}}
}
}
If someone can help me it will be great.