[rt-users] Custom Fields: Elements/ValidateCustomFields never gets values to validate so the "Input Must Match..." error text is always displayed even when values exist

Kevin Falcone falcone at bestpractical.com
Wed Mar 7 16:28:03 EST 2012


On Wed, Mar 07, 2012 at 07:04:35PM +0000, Geoff Mayes wrote:
> We're running RT 4.0.4 on RHEL6 and we have noticed that any custom
> field with "Validation" set (to "Mandatory", for example) will always
> display the validation error text "Input Must Match [Mandatory]" even
> when the custom field is populated with a value. These error messages
> are displayed when we view the "Jumbo" version of the ticket or when
> we click the "Custom Fields" box link which then displays
> Ticket/Modify.html. This seems to happen for all types of custom
> fields, but to give one specific example, we're definitely seeing this
> for custom fields using "Select one value", "Select box", and applies
> to "Tickets".

The code in question passes an empty argument list so that you always
see "This field is mandatory" and know that removing content will
cause an error.  This behavior is "intended" although we've considered
changing it in a major release.

-kevin

> I've spent the last hour debugging this issue.  Here's what I've found:
> - the error text is generated in html/Elements/ValidateCustomFields
> - no custom field values end up in html/Elements/ValidateCustomFields (i.e. the @values array) because its initial source of values, $ARGSRef, is always empty.
> - two of the pages where these errors occur, Tickets/Modify.html and Tickets/ModifyAll.html, are calling Elements/ValidateCustomFields with $ARGSRef always set to {}, which is why $ARGSRef in ValidateCustomFields is always empty.
> - I changed the ValidateCustomFields call in Tickets/Modify.html from $ARGSRef => {} to $ARGSRef => \%ARGS, but this only added an "id" key and value, such as this Data::Dumper output: "ARGSRef = $VAR1 = {#012          'id' => '362208'#012};"
> - So I'm thinking that (1) ValidateCustomFields needs to be called with $ARGSRef => \%ARGS and (2) \%ARGS needs to contain the data that ValidateCustomFields expects, which are keys of all the custom fields (e.g. "Object-RT::Ticket--CustomField-75-Value") and their corresponding values for the ticket being processed.
> 
> Am I missing something?  Is our installation fried for some reason?  Have we forgotten some RT_SiteConfig magic?
> 
> Many thanks for any help with this,
> 
> Geoff Mayes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120307/c443d79e/attachment.sig>


More information about the rt-users mailing list