Custom validation on custom fields?

Hi all,
I’ve looked through the wiki and the docs, plus on Google, but can’t find
anything about customizing validation. We have two custom fields which may
be empty or not, but if they have a value, it has to be of the right
format. Both are single-line text fields. How would I set up RT so that I
can apply a regular expression, or some other kind of formatting, to these
fields? Thanks in advance.

Alex Hall
Automatic Distributors, IT department
ahall@autodist.com

Hey Alex,On Fri, Oct 28, 2016 at 1:58 PM, Alex Hall ahall@autodist.com wrote:

Hi all,
I’ve looked through the wiki and the docs, plus on Google, but can’t find
anything about customizing validation. We have two custom fields which may
be empty or not, but if they have a value, it has to be of the right format.
Both are single-line text fields. How would I set up RT so that I can apply
a regular expression, or some other kind of formatting, to these fields?

It should be right there in the CF admin page.

There is even a drop down with some prepopulated options.

The (?# ) is a way to put a “human” name with the validation rule. For instance:

(?#State Abbreviation)[1][A-Z]$

-m


  1. A-Z ↩︎

Indeed there is, and I honestly don’t know how I missed it. All I can say
is I must have tabbed right past it, so the screen reader never spoke the
field’s name.

I noticed the pound sign being used a lot. Is the rule you mentioned in any
way tied to the field, or is it just an internal note so you know what you
were doing if you go back later? On a related note, is there a way to give
a more readable message after the field than
input must match [complex regex that most users won’t understand]
We use the hint, but can we clean up the text stating what the input must
match, or hide it entirely unless the text doesn’t match? The hints already
describe the format we need in a more readable way than a regex. Thanks.On Fri, Oct 28, 2016 at 4:02 PM, Matt Zagrabelny mzagrabe@d.umn.edu wrote:

Hey Alex,

On Fri, Oct 28, 2016 at 1:58 PM, Alex Hall ahall@autodist.com wrote:

Hi all,
I’ve looked through the wiki and the docs, plus on Google, but can’t find
anything about customizing validation. We have two custom fields which
may
be empty or not, but if they have a value, it has to be of the right
format.
Both are single-line text fields. How would I set up RT so that I can
apply
a regular expression, or some other kind of formatting, to these fields?

It should be right there in the CF admin page.

There is even a drop down with some prepopulated options.

The (?# ) is a way to put a “human” name with the validation rule. For
instance:

(?#State Abbreviation)[1][A-Z]$

-m

Alex Hall
Automatic Distributors, IT department
ahall@autodist.com


  1. A-Z ↩︎

Indeed there is, and I honestly don’t know how I missed it. All I can say is
I must have tabbed right past it, so the screen reader never spoke the
field’s name.

I noticed the pound sign being used a lot. Is the rule you mentioned in any
way tied to the field, or is it just an internal note so you know what you
were doing if you go back later?

Hold…

On a related note, is there a way to give a

more readable message after the field than
input must match [complex regex that most users won’t understand]

This.

I believe the validation comment is passed back to the end-user when
validation fails:

“Custom Field State must match State Abbreviation.” or something on that order.

for (?#State Abbreviation)[1][A-Z]$

FWIW, I am not sure if I’ve ever used the validation field of a CF. I
did have a conversation with Best Practical about it once, though.

-m


  1. A-Z ↩︎