CRM-17129 Checkbox custom fields for participants are not not rendered properly

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      Custom fields of html type checkbox are not rendered properly on confirm and thank you page on event registration page.

      I think changes due to commit at https://github.com/civicrm/civicrm-core/commit/c94d39fd has caused the regression.

        Attachments

          Activity

          [CRM-17129] Checkbox custom fields for participants are not not rendered properly
          Pradeep Nayak added a comment -
          David Greenberg added a comment -

          Reviewed the PR w/ Coleman and we're thinking the fix should happen lower down - e.g. in CRM_Core_BAO_CustomField::getDisplayValue

          Also, unless this is critical would prefer to see the change in 4.7 (PR for master).

          Thanks!

          Rares P added a comment - - edited

          The PR submitted solves the problem for me too.
          I would love to follow this issue, but I noticed that the follow feature is no longer available in the UI. Can someone check the permissions for basic users in JIRA? -> Never mind, I found it.

          Joe Murray added a comment -

          Hi Dave,
          We don't need this for our purposes and it looks like refactoring as requested will be more work than we can afford at the moment (maybe 2 days??). Giving it back to core.

          David Greenberg added a comment - - edited

          Assigning back to you since it looks like the regression is related to a prior commit of yours.

          I tested in 4.7 by creating a custom field type checkbox on Participant, and add that to the 'Your Registration Information' profile. I included 3 options.

          When registering, I checked the 1st and 3rd option. On the Confirm page, the display was incorrect (first checkbox label was repeated). Screenshots attached as well:

          Option 1, , Option 1

          NOTE: After completing registration, checked the saved custom field values and they are correct - so problem is in display only.

          Monish Deb added a comment -
          Monish Deb added a comment -

          Tested, working fine

          Brian Shaughnessy added a comment -

          this should probably be a candidate for backporting since 4.6 will be an LTS

          Brian Shaughnessy added a comment - - edited

          there's a flaw with this fix, but I'm not sure the best way to handle it because I'm not sure I understand all the conditions put in place.

          in CRM_Utils_Array::formatArrayKeys() we do the following:

          • grab all array keys where the element value = 1 (i.e. it is selected)
          • IF (lots of conditions), we set the original array to the keys array

          however, if no values are selected (this impacts a checkbox list), this function has no impact on the array, returns it as is, and renders them as a series of successive commas.

          in that case, I would think what we want to do is remove the unselected elements from the array, so only a clean array is returned. in other words... return the array keys where the value = 1 (or an empty array if there are none with a value of 1). obviously you guys thought there needed to be more conditions around when we simply return array keys with a value, but I don't know when/why.

            People

            • Assignee:
              Jitendra Purohit
              Reporter:
              Pradeep Nayak

              Dates

              • Created:
                Updated:
                Resolved: