Auth0 Home Blog Docs

Possible to have mandatory additionalSignUpField based on another field?

lock
auth0

#1

In Lock v11 additionalSignUpFields, is it possible to make a mandatory additional signup text field validate if a checkbox is checked?

So, the text field needs to have a valid value unless the checkbox is checked.

Use case: Post / zip code field needs to be filled and be a 4 digit value and is mandatory for submission unless the user indicates they are from a different country by checking the checkbox.


#2

:wave: @smarajitdasgupta we could possibly use an optional checkfield box as described here and implement a client-side validator, an example is here . So, we can design the logic that if we know the user needs to indicate a post/zip code to provide a hint stating they need to enter (if they haven’t), else return true.