On 10/22/12 18:00, rt-users-requ...@lists.bestpractical.com wrote:
Send rt-users mailing list submissions to
rt-users@lists.bestpractical.com
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
or, via email, send a message with subject or body 'help' to
rt-users-requ...@lists.bestpractical.com
You can reach the person managing the list at
rt-users-ow...@lists.bestpractical.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rt-users digest..."
Today's Topics:
1. Friendly Validation Errors? (Mike Kennedy)
2. Re: Size of the database. (Darin Perusich)
3. RT-Authen-ExternalAuth. (Julien CAUNAN)
4. Re: Size of the database. (Albert Shih)
----------------------------------------------------------------------
Message: 1
Date: Mon, 22 Oct 2012 03:27:45 +0000
From: Mike Kennedy<michael.kenn...@ucr.edu>
To: ""
<rt-users@lists.bestpractical.com>
Subject: [rt-users] Friendly Validation Errors?
Message-ID:
<4377a360f69d024197af65862debcc051fe0c...@exch-mbox-1.exch.ucr.edu>
Content-Type: text/plain; charset="us-ascii"
Hello,
I've searched the archives, Google, the wiki (so I'm sorry if the answer to
this is there, but I just missed it.)
Is there any way, short of editing the source, to have more friendly validation errors. So, rather than "Input
must match [Mandatory]" I could change it to say "This field is required." Or, instead of "Input
must match ^[a-zA-Z]+$", it could say, "Value must contain only letters."
Thanks,
Mike
Hello Mike,
you can change /Elements/ValidateCustomFields in a plugin like that that.
The code is like that:
my %Messages = ("[Mandatory]" => "This field is required",
"[^[a-zA-Z]+]" => "This field must contain letters");
foreach my $value( @values ) {
next if $CF->MatchPattern($value);
my $msg = exists($Messages{$CF->FriendlyPattern})
?$Messages{$CF->FriendlyPattern} :"Input must match".$CF->FriendlyPattern ;
$m->notes( ('InvalidField-' . $CF->Id) => $msg );
push @res, $msg;
$valid = 0;
}
That does work.
--------
Final RT training for 2012 in Atlanta, GA - October 23 & 24
http://bestpractical.com/training
We're hiring! http://bestpractical.com/jobs