Hey there. So, I am trying to build a page where all forms can be autofilled with some information that the user inputs at signup. I created custom signup and login, and changed the My Account page to display and update that information. I created a Members database with all the fills I require, and from my signup form, I am trying to collect al input data to that database as well as actually signing up the user as member.
My issue is that, although when I sign up from preview mode, the Members database is updated, the live site will not capture signups.
Could someone help me?
My code for the Sign Up form is as follows:
import wixUsers from ‘wix-users’ ;
import wixWindow from ‘wix-window’ ;
import wixData from ‘wix-data’ ;
let registration;
$w.onReady( function () {
$w( “#register” ).onClick((event) => {
console.log( “Button was clicked” );
$w( “#errorMessage” ).collapse();
$w( “#emailExists” ).collapse();
if ($w( “#email” ).valid && $w( “#password” ).valid && $w( “#company” ).valid && $w( “#name” ).valid) {
registerPerson();
console.log( “Trying to register” );
} else {
$w( “#errorMessage” ).expand();
console.log( “Missing Information” );
}
})
});
function registerPerson () {
let email = $w( “#email” ).value;
let password = $w( “#password” ).value;
let name = $w( “#name” ).value;
let company = $w( “#company” ).value
let toInsert = {
“name” : name,
“company” : company,
“email” : email
};
wixData.insert( “Members” , toInsert)
.then( (results) => {
let item = results;
} )
. catch ( (err) => {
let errorMsg = err;
} );
wixUsers.register(email, password, {
contactInfo: {
“name” : name,
“company” : company
}
})
.then((result) => {
wixWindow.openLightbox( "confirmation" );
})
. **catch** ((err) => {
let errMsg = err;
console.log(err);
$w( “#emailExists” ).expand();
} );
}