Custom Sign-Up Problem with contactInfo

Dear Community,

I seem to be having problems setting up a custom sign up if I try to include the contactInfo option in the register() command.

This is my code below.
You can see that when I comment out the custom info, this code works. But if I try to include it, then the sign-up will not be successful.

Any guidance is greatly appreciated. Thank you.

// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$w.onReady( function () {
$w(‘#submit’).onClick( function () {
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;
//let custom = $w(‘#custom’);
//let firstName = $w(‘#firstName’);
//let lastName = $w(‘#lastName’);
wixUsers.register(
email,
password,
{
// contactInfo: {
// “firstName”: firstName,
// “lastName”: lastName,
// “custom”: custom}
}).then(()=>{wixLocation.to(‘/account/home’);})
})

});

#customsignup #signup #contactInfo

If you are using a custom lightbox for signup like myself, then I would use something like the following:

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("/account/home");  //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});

This will hopefully close the lightbox after registering details before returning to account home page, then both names and custom will be saved in contacts and once site member is approved the member details will be added to ‘members’ database.

Thank you! That worked.

Hi @givemeawhisky ,
I just realized my sign-up form will go through regardless of any input errors.
Do you have a sense on how to rectify this?

Thank you

Try validating user input…
https://www.wix.com/code/home/example/Custom-Validations
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…
https://support.wix.com/en/article/wix-code-about-validating-user-input-with-code
https://www.wix.com/code/reference/$w.ValidatableMixin.html