Good evening
Today i decided to make a social media website and started off with a registration form in lightbox.
The intention is that everyone who types in their email and password and clicks on registration, they will be send to “start”. But it instead stays on the testing page.
This would be the code:
import wixUsers from ‘wix-users’ ;
import wixLocation from ‘wix-location’ ;
$w . onReady ( function () {});
export function registerNow_click ( event ) {
let email = $w ( ‘#registerEmail’ ). value ; let password = $w ( ‘#registerpassword’ ). value ;
wixUsers . register ( email , password )
. then (() => {
wixLocation . to ( ‘/start’ );
});
}
I´m looking forward to replies and would be happy for everything you reply with
Check that the element IDs are all exactly correct with identical capitalization (i.e. "#registerpassword" is not the same as "#registerPassword" )
If you are testing repeatedly with the same email you will need to delete the test member each time before a new test
Make sure “start” is the correct page name
Test with different pages instead of “/start” to see if it works for another page
Remove the click handler from the button and try the code below instead, it’s based on what I use to successfully add a new member and redirect them to the desired page.
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w('#registerNow').onClick(function () {
let email = $w("#registerEmail").value;
let password = $w("#registerpassword").value;
wixUsers.register(email, password)
.then((result) => {
let resultStatus = result.status;
console.log(resultStatus);
wixLocation.to("/start");
})
.catch((err) => {
console.log(err);
});
});
});
Check your browser’s console log to see if there are any errors when the code is run, and screenshot and send it over