i have created a custom registration form tha connects to wix CRM, everything works perfect ( below is the code), however i would like to show messages once the submit message is clicked in case the user enter a wrong value. or once the submission is successful. i have tried to read article regarding the validations but i didnt know how to apply it to the code. i would appreciate if someone can help with an example for the validation.
$w.onReady(function () { $w('#submit').onClick(function () { wixUsers.register($w('#email').value, $w('#password').value, { "contactInfo": { "firstName": $w('#name').value, "username": $w('#username').value, "Phone": `${$w('#countrycode').value} ${$w('#phone').value}`, "reference": $w('#reference').value, "DOB": `${$w('#day').value}/${$w('#month').value}/${$w('#year').value}`, "country": $w('#country').value, "city":$w('#city').value, }}) }) });
Dear Nahifa
First of all, remember to read this https://www.wix.com/code/home/forum/community-discussion/wix-code-forum-guidelines-for-posting-a-question. You will get better help and others can benefit from your questions if you have a subject line that tells people what you ask for.
Update your post subject from "hello" to something like "How do I show message efter user registration" that way more people that have that knowledge will help you.
When you use register method you can use it's promise which will execute after the register is done.
wixUsers.register(email, password, { contactInfo: { "firstName": firstName, "lastName": lastName, "phone": phone, "nickname": nickname } } ) .then( (result) => { let resultStatus = result.status; // Here you can check and handle if user went ok // and show messages or whatever you would like to do // $w("#messageBox1").show(); // Show a element example } );
Happy coding!