Hello team, I am working on building a custom sign up form in a lightbox with Editor X. I have followed the tutorial and have managed to link correctly the following fields:
First Name
Last Name
Password
Custom Field
However I am having difficulty linking input fields with the address field in the members data.
Please see below the code I have used:
import { authentication } from 'wix-members'; let emails = []; $w.onReady(function () { $w('#register').onClick( () => { const password = $w('#password').value; const residence = $w('#residence').value; const phone = $w('#telephone').value; const addressLine = $w('#addressLine').value; const city = $w('#city').value; const postalCode = $w('#postalCode').value; const email = $w('#email').value; emails.push(email); let options = { contactInfo: { firstName: $w('#firstname').value, lastName: $w('#lastname').value, emails: emails, residence: $w('#residence').value, phone: $w('#telephone').value, city: $w('#city').value, postalCode: $w('#postalCode').value, addressLine: $w('#addressLine').value }, privacyStatus: 'PUBLIC' } authentication.register(email, password, options) .then((registrationResult) => { const status = registrationResult.status; // When the site is configured for automatic approval, status is "ACTIVE" and the member is approved and logged in. console.log('Member registered and logged in:', registrationResult); }) .catch((error) => { console.error(error); }); }); });
Thanks all for your help!!!
Thanks everyone. I have managed to find a workaround by creating custom member fields with a random name, for example: "Addresss", then I have connected them via the code as above and then renamed them in the member fields. Let me know if anyone else is looking for help with this and I can explain.
Hi,
I don't know if you can submit the address directly with the register() method. At least this field does not appear in the documentation.
What you can do is to register the user and then() update the member's address using backend updateMember method.