Hi Adam,
We can do this by putting validation on this field using does not match pattern. For example if the we show the validation is more than 4 character and less than 2 characters by using the below validation.
1. Select field from first dropdown and select does not match pattern from second dropdown.
2. Select Select a pattern… from third drop down and choose Custom Pattern
3. Select Any letter option 4 times from ‘Insert special character#%92 dropdown
4. Add two more validation same type with selection of Any letter option is 3 times and 2 times.
By doing this field give the validation if you enter more than 4 characters and less than 2 character.
We can write below code for onAfterChange event for display the validation message
Var strLength = eventObj.Site.text.length;
If(strLength < 2 || strLength > 4)
{
thisXDocument.UI.Alert("String length is Invalid");
return;
}