Custom Sign-up Goes Through Even with Input Errors

Dear Community,

My custom sign-up is getting successfully processed even if there are input errors. I’m not sure what to include to make it work.

Here is my code:

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

$w.onReady( function () {

$w("#submit").onClick( (event) => { 

let email = $w(“#email”).value;
let password = $w(“#password”).value;
let first = $w(“#firstName”).value;
let last = $w(“#lastName”).value;
let custom = $w(“#custom”).value;

wixUsers.register(email, password, {
contactInfo: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“custom”: $w(‘#custom’).value,
}
} )
.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to(“/home”); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );

});

#customsignup #customregistration #signup #validation

Try validating user input…

The above link is for a Wix Code example which you can open yourself in Wix Editor and view it all on screen and with all the code too.

Plus have a read of…