[Rt-commit] rt branch, 4.2/cf-checkboxes, created. rt-4.2.3-23-gdd44e3c

Alex Vandiver alexmv at bestpractical.com
Wed Mar 5 14:31:43 EST 2014


The branch, 4.2/cf-checkboxes has been created
        at  dd44e3c5071a028ec3779323683ea9ae9f521d85 (commit)

- Log -----------------------------------------------------------------
commit dd44e3c5071a028ec3779323683ea9ae9f521d85
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Mar 5 13:04:04 2014 -0500

    Use the correct -Values on select-multiple checkbox inputs
    
    4b21442e changed to having a method to generate CF field names.
    However, it incorrectly encoded that all "List" renderings (both radio
    and checkboxes) should use the singular '-Value'.  Prior to 4b21442e,
    the _only_ rendering which used '-Value' was the radio rendering, which
    set $name explicitly; other locations hardcoded '-Values', or (in the case
    of checkboxes) set $name to '-Values'.
    
    This resulted in checkboxes using '-Value', which in turn caused the
    same value to be be able to be re-added, and appear multiple times on
    the same ticket; see [rt3 #29392].
    
    Switch the GetCustomFieldInputName method to only return '-Value' for
    the radio rendering of selects, restoring the same input names as prior
    to 4b21442e.  It also removes a now-misleading comment, as the $name
    variable is used for _all_ Select inputs, not just radio/checkboxes.  As
    such, ensure that (in the absence of a $Name, which currently occurs
    nowhere in core RT), the '-Value' option would still only be generated
    for radiobuttons.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 8f690fe..18e0c59 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1752,7 +1752,7 @@ sub GetCustomFieldInputName {
     my $name = GetCustomFieldInputNamePrefix(%args);
 
     if ( $args{CustomField}->Type eq 'Select' ) {
-        if ( $args{CustomField}->RenderType eq 'List' ) {
+        if ( $args{CustomField}->RenderType eq 'List' and $args{CustomField}->SingleValue ) {
             $name .= 'Value';
         }
         else {
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 222fcd9..e1c010b 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -147,10 +147,8 @@ if ( $RenderType eq 'Dropdown' ) {
     $Rows = 0;
 }
 
-# The following is for rendering checkboxes / radio buttons only
 my ($checktype, $name);
-
-if ( $MaxValues == 1 ) {
+if ( $MaxValues == 1 and $RenderType eq 'List' ) {
     ($checktype, $name) = ('radio', $Name || $NamePrefix . $CustomField->Id . '-Value');
 } else {
     ($checktype, $name) = ('checkbox', $Name || $NamePrefix . $CustomField->Id . '-Values');

-----------------------------------------------------------------------


More information about the rt-commit mailing list