Skip to main content
Joe Bouch
Participant
January 21, 2025
Question

Help to write a custom validation script

  • January 21, 2025
  • 1 reply
  • 157 views

I have a form field that is a measurement entered as a character string.

The proper format is inches followed by eighths of an inch (i.e. 13 3/8).

I would like to validate that:

  1. the inches are a whole number between 1 and 30
  2. the numerator of the fraction is between 0 and 7
  3. the '/' exists
  4. and the denominator is 8

 

How would I write that in a custom validation script?

Thank you in advance for your help!

 

1 reply

try67
Community Expert
Community Expert
January 21, 2025

I would strongly recommend using two text fields for this, one for the inches and another for the numerator of the fraction. The rest should be static text. It will make validating the user input much easier.