CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • User profile checkbox fields being displayed in Views w/out comma separation
Pages: [1]

Author Topic: User profile checkbox fields being displayed in Views w/out comma separation  (Read 808 times)

Chasen

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.70
  • PHP version: 5.3.9
User profile checkbox fields being displayed in Views w/out comma separation
October 17, 2012, 04:18:58 pm
Hi Guys,

Been building a website in Drupal 7/CiviCRM for a while now and we have most of the bugs/tweaks/etc all ironed out. There's one issue that we've been dealing with but can't seem to get a resolution for and I think it's stemming from the CiviCRM module so thought I'd ask it here.

We have 2 types of users, Type A and Type B each of which has custom fields attached to their profile. These custom fields include text areas, check boxes, drop down lists, etc.

We're having an issue with the checkbox fields (which can have multiple values). They are being displayed (through Views) without any comma separation (or separation of any kind, not even a space). The way the displays are set up we need to use views to pull various pieces of data through to custom profiles (so we're not using the default Drupal or CiviCRM profiles).

Here's a scenario:

User Type A has a custom field on their profile called "Service Types" and they can select as many service types that they cater to (selected as checkboxes).
Let's say this user selects "Mechanical Engineering", "Boat Building" & "Boat Repair" as the 3 checkboxes they want to choose.

When displaying this on their profile, via views, we would like it to display as:

Service-types: Mechanical Engineering, Boat Building, Boat Repair

However, it is displaying as:

Service-types: Mechanical EngineeringBoat BuildingBoat Repair

The view is setup to call in "CiviCRM Custom: Type A Custom Fields: Service-type (Service-type)" and we've set the label to "Service-types:" and then the datafields (i.e. the checkboxes) should display after that, which they are, but there's no option to comma separate the returned values. I'd even settle for just 1 space separation (i.e. nbsp; but I'd really like comma separation if possible).

What I've tried:
Checking and changing every setting in the View - tried grid, html list, unordered, field settings, groupings, etc
Editing each field checkbox option in CiviCRM so that instead of "Mechanical Engineering" it would save as "Mechanical Engineering " but the space is auto removed. Also tried with   at the end, which is also auto removed.
Gone through the CiviCRM settings but can't find anything in there

I'm hoping that there's something simple I'm missing as it's one of the few things left to fix.

Also, we were thinking that if this can't be done, we could maybe try saving each checkbox field with something like "&&" suffixed to the end (or some other combination of symbols/characters that would never show up normally) and then using JS/Jquery to find and replce "&&" with ", " maybe? Seems pretty dirty so I'd like to avoid if possible.

Any help is appreciated.

Thanks,
Chris

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: User profile checkbox fields being displayed in Views w/out comma separation
October 17, 2012, 04:57:05 pm

this is a bug in the civicrm views integration code.

i dont think its a super hard bug to fix, so would be great if you can take a look and figure out what / where the issue is and how to potentially fix it.

i suspect its the handler code in:

drupal/modules/views/civicrm.views.inc, approx line 417 or so

if u need help getting started etc, ping us on IRC. would be great to knock this one off

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Chasen

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.70
  • PHP version: 5.3.9
Re: User profile checkbox fields being displayed in Views w/out comma separation
October 17, 2012, 05:19:12 pm
Will do. I'm no module developer :P but I'd be happy to help where I can (screenshots, exports, code snippets, etc).

I'll go through the breakdown and see what I can dig up and post back here.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • User profile checkbox fields being displayed in Views w/out comma separation

This forum was archived on 2017-11-26.