[rt-users] Input must match [Mandatory]?

Schultz, Eric ESchultz at corp.untd.com
Mon Apr 30 11:35:33 EDT 2007


> How can I alter this to make more sense to my users?  They 
> don't necessarily
> know what [Mandatory] means and, quite frankly, I think it 
> could be a bit
> clearer myself.  Where in the code do I find it to change it?

For this, I modified lib/RT/Interface/Web.pm so that it would set the
failure result manually before attempting to call the
AddCustomFieldValue code:

*** 1218,1223 ****
--- 1218,1228 ----
                    elsif ( $arg =~ /-Values$/ and
!$CustomFieldObj->Repeated) {
                        my $cf_values = $Object->CustomFieldValues($cf);

+                       if (!@values and $CustomFieldObj->IsMandatory) {
+                           push( @results, $CustomFieldObj->Name . ":
you must have at least one value" );
+                           next;
+                       }
+
                        my %values_hash;
                        my @addcfresults = ();

For that one, I can't provide a clean unified diff, since this is my
hacked 3.4.1 code.  That should get you close enough to where you need
to be, however.
 
> Also, if input into a CF is mandatory, wouldn't it make sense 
> to remove the '(no value)' option from a Select One type CF?

I noticed this, too, and fixed it in
share/html/Elements/EditCustomFieldSelect, just by adding a simple if
statement around that part of the code:

@@ -57,7 +57,9 @@
 % }
             ><% $value->Name%></option>
 % }
+% if (!$CustomField->IsMandatory) {
         <option value="" <% !$selected && 'SELECTED' %>><&|/l&>(no
value)</&></option>
+% }
       </select>
 <%ARGS>
 $Object => undef



Eric Schultz
United Online



More information about the rt-users mailing list