You can use a regular expression in the validation tab for your field to validate the input.
The regular expression
^.{6,7}$
validates that the field has a minimum of 6 characters and a maximum of 7.
Other than changing the set of numbers, you can also set it to a maximum, such as ^.{,7}$ (a maximum of 7 characters), or a minimum, ^.{6,}$ (a minimum of 6 characters).
For other kinds of validation, you can check here.