Keep getting an error with Custom Sign up form code

I am new to WIX code, and I can’t seem to understand why I keep getting the following error.
I am creating a custom sign up form for my members to register with more information than the standard registration from WIX. I created the following to match up with each of my input fields.


However, when I enter the Developer Console to test the form it gives me the following error.
All my fields are set to accept the appropriate type of information (password, text, dates etc). When I publish to site and try to enter to test the form it stays on this lightbox and doesn’t go anywhere else or enter the information in my contact list.


I will appreciate any feedback on this issue, I have been looking everywhere for an answer but I am not sure how to fix it.

Thank you!
#signup #register #wixuser #error #sdkerror

You need to pass an object containing aditional details. so you first need to define an object called registration options and include all the aditional information then you pass that in the wixUsers, so it will look like this:

let registrationoptions = {
name: 'jon',
lastName: 'doe'}

wixUsers.register(email,password,registrationoptions)

Thank you! The error did stop appearing and on the live site I am able to create an account. However, the information that is inserted in the form doesn’t get recorded into the WIX contact list. The information isn’t synchronized. Only the email and password get put into the system. Below is how I set it up:

Have a read of wix-users > register() and view their example codes for ‘Register a user as a site member with registration options’.

As for not closing, well if you want to do that you will need to use WixWindow and tell the lightbox to close after the registration is successful.

This below is my code for my own custom registration lightbox and it all works perfectly.

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   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": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  wixWindow.lightbox.close();
  wixLocation.to("/main-page");  //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});

This works perfectly and closes after registering details before returning to home page, then both names will be saved in contacts and once site member is approved the member details will be added to ‘members’ database.

Take it and add your additional user inputs and see if it works for you, hope this helps.