Additional fields for a custom Sign up form

Hello, I am trying to add additional fields to my sign up form. What I am trying to do is add phone, address, full name and checkbox tag information.

I have looked at the documentation with Lock and other ways, but it is really unclear how to do this. I am using a fully custom build form that works with sign up/login. I have looked at the lock code

dditionalSignUpFields: [{
    name: "address",
    placeholder: "enter your address",
    // The following properties are optional
    icon: "https://example.com/assests/address_icon.png",
    prefill: "street 123",
    validator: function(address) {
      return {
         valid: address.length >= 10,
         hint: "Must have 10 or more chars" // optional
      };
    }
  },
  {
    name: "full_name",
    placeholder: "Enter your full name"
  }]

but don’t know how to add it here ( to the signup function)

   function signup() {
        var button = this;
        var email = document.getElementById('email').value;
        var password = document.getElementById('password').value;

        button.disabled = true;
        
        webAuth.redirect.signupAndLogin({
          connection: databaseConnection,
          email: email,
          password: password,
          captcha: captcha.getValue()
        }, function(err) {
          if (err) displayError(err);
          button.disabled = false;
        });
      }

I am just looking for a way to add additional sign up fields to my form, to be sent to the backend.
An example code would be very helpful.

Thank you.

Hey @MIPS,

Have you checked out the following function:
https://auth0.com/docs/libraries/auth0js#signup

Regards,
Sidharth Chaudhary

1 Like

Thank you very much, that was exactly what I was looking for, I have implemeted everything and it works. I also have another last question, I tried sending an array as a metadata, but got an error only string can be metadata.

Is it possible to send an array as metadata { mynames: [‘first’,‘second’] }

Previous message deleted due to SPAM reasons.

1 Like