Formify Docs

Digits Only

Strip everything except digits

Digits Only

The digitsOnly formatter removes every character that is not a digit.

Usage

validationSchema: {
  otp: { format: "digitsOnly" },
}

Result

InputResult
12a34-bc56123456

Things to know

  • The equivalent normalize: "digits" preset runs on change with the same effect.

On this page