How do I add a phone number as a required registration field?

  • How do I add a phone number as a required registration field?

1 Answer

1

Hey there! You can achieve this by doing the following:

  1. Open your project settings and select your collection.
  2. Click on Create Field.
  3. Select Input field, marking it as required as you go.
  4. Click on “Continue to continue in Advanced Field Creation mode”
  5. Open the “Validation” tab, and click on “Add Filter”
  6. Change “contains” to “matches Regexp”
  7. Enter the following regular expression: /^\+?[1-9]\d{1,14}$/
  8. Save your field and collection.

Hope this helps!

In addition for @carmenh answer, you also need to uncheck the "Nullable" field in case you are willing to use API.

@Abdallah Do you give consultancy on directus?