- my %TOP = $m->request_args;
- $Default = $TOP{ $NamePrefix .$CustomField->Id . '-Values' }
- || $TOP{ $NamePrefix .$CustomField->Id . '-Value' };
+ my %TOP = %$DECODED_ARGS;
+ $Default = $TOP{ $Name } if $Name;
+ # check both -Values and -Value for back compatibility
+ if ( $NamePrefix ) {
+ $Default //= $TOP{ $NamePrefix . $CustomField->Id . '-Values' }
+ // $TOP{ $NamePrefix . $CustomField->Id . '-Value' };
+ }
+ else {
+ my $prefix = GetCustomFieldInputNamePrefix(Object => $Object, CustomField => $CustomField, Grouping => $Grouping );
+ $Default //= $TOP{ $prefix . 'Values' } // $TOP{ $prefix . 'Value' };
+ }