Can I add custom fields in the Universal login signup screen?

I have enabled to all these configurations in this doc:

But I am still not able to see the custom fields that I setup in signup prompt via partials. I noticed that it mentioned somewhere else that it is only allowed to add custom fields to the classic login. Is that still the case? Or what other options I can choose if I want to use New Universal login?

Hi @tommy.tao

Welcome to the Auth0 Community!

You can set up custom fields via partials for the available prompts in the Management API. The ones available are:

  • signup
  • signup-id
  • signup-password

You can set these partials for the New Universal Login. The URL for the Management API would be https://{{auth0_domain}}/api/v2/prompts/signup/partials and an example body would look like this:

"signup-id": {
    "form-content-start": 
   "<div class="ulp-field">
      <label for="first-name">First Name</label>
      <input type="text" name="ulp-first-name" id="first-name">
    <div class="ulp-error-info">
       First Name is Required
     </div>
   </div>",
  }

You can also use scripts inside the body of the partials to execute specific checks on these elements. Here is an example of a login partial which will check if the checkbox element has been checked prior to submission:

 "login": {
        "form-content-end": "
<script type='text/javascript'>
function requiredCheck(element, formSubmitted, eventName) {
   if(!formSubmitted){return true;}return element.checked;
}
</script>

<div class='ulp-field'>
  <input type='checkbox' name='ulp-terms-of-service' id='terms-of-service'>
  <label for='terms-of-service'>Check this</label>
      <div class='ulp-error-info' data-ulp-validation-function='requiredCheck' 
      data-ulp-validation-event-listeners='change'>Please check the box</div>"
}

The location of and their syntax of these partials are shown in the documentation. In your case, the third example would be the one for signup.

Everything that you need to know about the partials should be documented inside the link your posted.
If you do not see any changes or you cannot submit the request, make sure the body is correctly formatted. The examples above should be accepted by the Management API.

If you have any other questions, feel free to leave a reply!

Kind Regards,
Nik

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.