Hi ,
I have created custom sign up form by light up box and tested with no problem found, but my question is how to show a message like this " An account with this email already exists " if the email is already registered, assume i created hidden text message how to connect it to the code with database?
my code is :
import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; import wixWindow from 'wix-window'; $w.onReady(function(){ $w('#register').onClick(function (){ let firstName = $w('#fname').value; let lastName = $w('#lname').value; let email = $w('#email').value; let password = $w('#password').value; wixUsers.register(email, password, { contactInfo: { "firstName": firstName, "lastName": lastName, } } ) .then(()=>{ wixLocation.to('/events-wix'); wixWindow.lightbox.close(); }) }) }) thank you
Alaa:
Anything you add to users using wix-users.register will create a record in the dashboard CRM. The problem is that you are creating a copy on your web site so if you change information you keep on your web site in the CRM on your dashboard then you will create synchronisation problems. If you are simply using the CRM for sending triggered Emails and shoutOuts then you should be OK. The CRM APIs as they currently exist are write only from your page.
Cheers
Steve
Alaa:
The only way to do this is to maintain the contact information in your own data collection. The CRM API is write only so you cannot read from it to validate the existence of new registrations.
What you need to do is create a data collection that contains the information that you want to monitor. Then when you are asked to register the user information you can first try to get a matching record from your data collection. If there isn't a match then you can register the user and if successful you can add the user record to your data collection.
Here is an example of this that I put together:
https://stcroppe.wixsite.com/steveonsoftware/example-code/wix-register-contact-update
Steve