Some users are unable to register on my site and continue to next page

Dear @yisrael-wix ,

Some of my users are unable to continue to the next page whilest clicking on the button ‘volgende’ (English: ‘Next’) on the page: https://www.vocap.info/copy-of-inloggen. Most users however, do not experience any issues.

This page is for registration of the email and password in the wix members list.
The user input fields are:

  • ‘E-mail’ (Eng.: email)

  • ‘Wachtwoord’ (Eng.: password)

  • 'Bevestig wachtwoord (Eng. confirm password)


This is an impression of the page in question:


The page code:

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$w.onReady( function (){
$w(‘#register’).onClick( function (){
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;
let password2 = $w(‘#password2’).value;

//if the user is already logged in, we skip this page and go to the next page.
if (wixUsers.currentUser.loggedIn === true ) {
wixLocation.to(‘/registreren’);
}

else if (password === password2 && password !== undefined && password2 !== undefined && password !== “” && password2 !== “”) {

//if password matches and is defined we console.log success message and register the user

    console.log("The passwords match!"); 

    wixUsers.register(email,password)    
    .then(()=>{ 
        wixLocation.to('/registreren');  
        }) 
    } 

//if password are not defined console.log error message
else if (password === undefined | password2 === undefined | password === “” | password2 ===“”) {
console.log(“The passwords are not defined”);

    $w('#passworderror').show(); 
    } 

//if passwords do not match console.log error message
else {
console.log(“The passwords do not match!”);

    $w('#passworderror').show(); 
    } 
}); 

})


I have myself not spotted any errors in the code, so I am a bit at a loss why some users experience problems clicking on the ‘volgende’ (Eng.: next) button.

Best regards,

Chiel Buseyne

Hey Chiel,

Your page has two onReady() functions which is invalid. Only one (the last) is recognized. This will definitely cause problems.

Dear @Yisrael,

Is this the correct way to do it?

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$w(‘#register’).onClick( function (){
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;
let password2 = $w(‘#password2’).value;

//…

Best regards,

Chiel Buseyne

Unfortunately, that did not seem to do the trick:


It is quite insistent that the page should be ready before it can run any code.

@info85223 I see three onReady() functions in your page code. That simply won’t work.

@yisrael-wix ,

Could you give a suggestion as to how it should be done? I am a bit confused. :frowning:

As as far is I know, I only have one onReady function in the first place, see image:

@info85223 OK. However, the problem seems to be in your site code. This line fails:
let voornaamgebruiker = $w(“#headerDataset”).getCurrentItem().voornaam;

I get the following error message:


This is because headerDataset does not have a current item. The collection Leden is empty.

Also, keep in mind that the wix-users API is only partially functional in Preview. You will need to conduct further tests in Live using console.log() statements and the browser’s console.

Thanks @yisrael-wix ,

I will add further console.log() statements and continue testing.

Dear @yisrael-wix ,
Dear other wix experts

Concerning the following page: https://www.vocap.info/signup

I removed the reference to the headerdataset in my site code just to be sure, although it it only threw an error in preview mode. I added further console.log() statements and checked this as well, but did not find anoy more errors. However, the issue seems to persist. Specifically the issue is the following for users that are not logged in:

  • The code does not always register the user in the member list as it should and then gets stuck or continues without registering in the member list.
  • The then(() statement is not always executed. It is executed with about 8 out of 10 users. It should always be executed, as a user can only register in the member list once and they need to continue to the next page.
  • As stated, many users don’t have problems. I myself was unable to simulate the problem.

What could be causing this?

This is really giving me a hard time, so I hope you will be able to guide me.

wixUsers.register(email,password)
.then(()=>{
wixLocation.to(‘/registreren’)
})
}

Kind regards,

Chiel Buseyne

Can someone please have a look into this.

Having waited unfruitfully for an answer for quite some time, I decided to drop the register API from my code. So never mind my question anymore. I hope however that you not that the register API is buggy and that it ought to be fixed.