Hello! Please help my poor brain for a moment.
I’m creating a custom registration form.
Here is what the form looks like:
Here is my code:
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#register’).onClick( function () {
let firstName = $w(‘#firstName’).value;
let lastName = $w(‘#lastName’).value;
let email = $w(‘#email’).value;
let resortcode = $w(‘resortcode’).value;
let password = $w(‘#password’).value;
wixUsers.register(firstName, lastName, email, resortcode, password)
.then(() => {
wixLocation.to('/home');
})
})
})
Here is the error I get when testing it:
Wix code SDK error: The registrationOptions parameter that is passed to the register method cannot be set to the value savoyjess17@gmail.com. It must be of type object.WelcomeLine 12You are currently in preview modeSaveBack to Editor
When I click the “register button” nothing happens. Is this because of the above error? I can’t find what it wrong with it. If you can, pleeeeease fill me in.
Thank you!! - Jess
Well right off the bat i see this line is broken
let resortcode = $w(‘resortcode’).value;
it should be let resortcode = $w(‘#resortcode’).value;
don’t know if that is breaking your code or not.
the only thing that i really see different in your code from mine is the
wixUsers.register(firstName, lastName, email, resortcode, password)
My code that works looks like this
$w(‘#submit’).onClick(() => {
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“phoneNumber”: $w(‘#phoneNumber’).value,
“street”: $w(‘#street’).value,
“city”: $w(‘#city’).value,
“state”: $w(‘#state’).value,
“zipcode”: $w(‘#zipcode’).value,
“password”: $w(‘#password’).value
}
}).then(() => {
//Everything went good, user was registered, now going to redirect
console.log(‘user registered successfully’);
wixLocation.to(‘/plans-pricing’);
}). catch ((err) => {
//If there is an error it will not redirect, it will console.log the error
console.log(${err}: Error
)
});
I am not a code expert by a long shot, I am working on my own login issue atm, but i do have my signup part working so maybe my code can help you.