Custom Registration Form for Private Memberships + Dashboard Pages

import wixusers from ‘wix-users’ ;
import wixlocation from ‘wix-location’
import wixwindow from ‘wix-window’ ;
import wixdata from ‘wix-data’ ;
let registration;

$w.onReady( function () {
$w( ‘#registrationButton’ ).onClick((event)=>{
console.log( “Button was Clicked” );
$w( ‘#errorMessage’ ).hide();
$w( ‘#emailExists’ )
if ($w( “#email” ).valid && $w( “#password” ).valid) && $w( “#firstname” ).valid && $W( “#lastname” );
let email = $w( “#email” ).value
let password = $w( “#password” ).value
let first = $w( ‘#firstname’ ).value
let last = $w( “#lastname” ).value
wixusers.register(email, password, {
contactinfo:{
“firstname” : first,
“lastname” : last
}
})
.then((result) =>){
$w( “#SuccessMessgae” ).show();
setTimeout(() => {
$w( ‘#SuccessMessgae’ ).hide();
}, 3500 );
$w( “#email” ).placeholder = “email” ;
$w( “#password” ).placeholder = “password” ;
$W( “#firstname” ).placeholder = “first name” ;
$w( “#lastname” ).placeholder = “last name” ;
$w( “#email” ).value = “” ;
$w( “#password” ).value = “” ;
$w( “#firstname” ).value = “” ;
$w( “#lastname” ).value = “” ;
})
. catch ((err) =>{
let errMsg = err;
console.log(err);
$w( ‘#emailExists’ ).show();
});
console.log( “trying to register” );
} else {
$w( ‘#errorMessage’ ).show();
console.log( “Missiong Information” );
}
});

});

Hi Suman,

This error is happening because of the parenthesis after valid before the && with the error.

To learn how to debug your Corvid code please read the following article.

Corvid: Testing and Debugging Your Code

Hope this helps!

Dara | Corvid Team

How to solve this problem…

You forgot to make it an arrow function, just after the equal (=) sign, you need to write the mark greater than (>);
On line 10, add the red mark as the code below.

.then((results) => {