Right now profiles enable the create of individual checkboxes and list selection, but there's no way to create a group of RELATED checkboxes. Here's an example of a non-Drupal page that I'd like to emulate:

http://www.billingstennis.org/members/findagame/index.cfm

When tennis players enter their "play type," they have three options that they can check: singles, doubles, and mixed. They can choose more than one if they wish, but the interface makes it clear that the three options are related.

Drupal's forms API includes a form_checkboxes function (soon to be replaced, of course, by the new forms API). It would be great if similar functionality could be added to the profiles module.

Comments

sheldon rampton’s picture

Title: Support for checkbox groups as a profile field type » Here's a patch that should do it
StatusFileSize
new5.91 KB

I did some hacking on the profile module and came up with a patch that adds checkbox groups. I think this patch also fixes the problem with date displays that has been mentioned recently in a separate bug report.

sheldon rampton’s picture

Title: Here's a patch that should do it » Add checkbox groups field to profile module

Oops. I seem to have screwed up the title of this feature request. Hopefully this changes it back.

kbahey’s picture

Title: Add checkbox groups field to profile module » Support for checkbox groups as a profile field type

Changing title to old one to avoid confusion.

Rezzo’s picture

Thank you, very useful. I need to implement this in a large community website, is this going to be officially implemented? Or will I probably lost every data stored via checkbox groups?

Anyway, using v4.6.3 I had these part rejected from patching process:

***************
*** 29,34 ****
         <li>single-line textfield</li>
         <li>multi-line textfield</li>
         <li>checkbox</li>
         <li>list selection</li>
         <li>freeform list</li>
         <li>URL</li>
--- 29,35 ----
         <li>single-line textfield</li>
         <li>multi-line textfield</li>
         <li>checkbox</li>
+       <li>checkbox group</li>
         <li>list selection</li>
         <li>freeform list</li>
         <li>URL</li>

But it works correctly.

Rezzo’s picture

Is there a way to keep checkboxes selected when a user goes to modify his profile? They're all unselected even if they were stored before.

Thanks

Rezzo’s picture

My fault, sorry: I changed name to all my fields and got lost the relation between field value and checkbox selection when modifying a user profile. Checkboxes remain selected.

jasonz-1’s picture

Version: 4.6.3 » 4.7.2

Any chance this can be ported to 4.7.2? I tried modifying the patch myself but couldn't get it to work. I'll try again and post my progress.

beginner’s picture

Version: 4.7.2 » x.y.z

All features go into cvs. If you want this, please provide a patch against cvs.

jasonz-1’s picture

Version: x.y.z » 4.7.2
Assigned: Unassigned » jasonz-1
StatusFileSize
new5.72 KB

I managed to modify the patch to work with 4.7.2.

beginner’s picture

Version: 4.7.2 » x.y.z

Everybody: if you are interested, there is a patch for 4.7.2 in #9.
Unfortunately, as per Drupal's policies, no new feature will be committed in a stable branch.

Now, if you want to have this function in future releases as well (4.8 onwards), a patch against cvs must be provided.

Guy Shepperd’s picture

this is awesome, Finally found something via a search of the Site that I need!

Now only one question?

this is the patch for 4.7.2 is this to replace the Profile module? (patch on #9)

and is that how I implement it?

Thanks

Guy Shepperd
www.speedsurfing.com

beginner’s picture

@guy: you need to patch the 7.2 module with the patch attached in #9.
About applying patches, see:
http://drupal.org/node/22568

But if you guys want this for the next version, you need to code a patch against cvs, and have it reviewed, otherwise, you are still left without this feature next time you upgrade.

moshe weitzman’s picture

Version: x.y.z » 6.x-dev
Status: Active » Closed (duplicate)
beginner’s picture

Status: Closed (duplicate) » Needs work

How can an issue be a duplicate of itself?

moshe weitzman’s picture

Status: Needs work » Closed (duplicate)
moshe weitzman’s picture

Status: Closed (duplicate) » Needs work

unduping this since it has a patch that actually works.

zmove’s picture

I'm upping the problem because it's not officially resolved, and I just tested Drupal 6-dev and it's not changed...

beginner’s picture

Version: 6.x-dev » 7.x-dev

This issue is assigned to jasonz, but he provided a patch for 4.7 (#9) instead of HEAD, so his patch was never considered for inclusion.
Now, it's too late for D6.

zenoyu’s picture

Title: Support for checkbox groups as a profile field type » Support for checkbox groups as a profile field type in Drupal 5.20
Version: 7.x-dev » 5.x-dev
StatusFileSize
new34.02 KB

I have customised the module to allow using checkboxes group by the article in Drupal 4

beginner’s picture

Version: 5.x-dev » 7.x-dev

don't downgrade the version. You are making the same mistake as Jason (see comment just above yours).

beginner’s picture

Title: Support for checkbox groups as a profile field type in Drupal 5.20 » Support for checkbox groups as a profile field type

title!

nvl.sateesh’s picture

hey! i tried applying the patch to drupal 5.x and it seems to work well... of course, i did not follow the line numbers... :-)

eddanx’s picture

I successfully applied this patch to drupal 5.7. I just copied & pasted from the patch manually into profile.module. I couldn't get it to display when viewing people's profile, though, so I headed to profile_view_field(), and made it work with replacing

      case 'checkboxes':
        $values = split("[,\n\r]", $value);
        $fields = array();
        foreach ($values as $value) {
          if ($value = trim($value)) {
            $fields[] = $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
          }
        }

with

      case 'checkboxes':
         //$values = split("[,\n\r]", $value);
         $fields = array();
         foreach ($value as $myvalue) {
           if ($myvalue = trim($myvalue)) {
             $fields[] = $browse ? l($myvalue, 'profile/'. $field->name .'/'. $myvalue) : check_plain($myvalue);
           }
         }
         return implode(', ', $fields);

Bit of a hack I guess, but it worked.

moshe weitzman’s picture

Anyone available to resubmit this for HEAD?

Susurrus’s picture

Assigned: jasonz-1 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.93 KB

Here's an updated version for HEAD. Seems to work fine for me.

marcoBauli’s picture

just another try:

#19 above works on D5.x

Just a glitch: when clicking on profile values to see other users that wrote the same (es: Other members from 'country'), the page title does not show the content of the value, but only the custom text specified in the settings for that field (result: Other members from *blank, no country shown*).

marcoBauli’s picture

just marked http://drupal.org/node/47744 and http://drupal.org/node/193075 as a duplicates of this issue (33044).

a couple of other older patches respectively for 4.7 and 5.x can be found there if interested.

marcoBauli’s picture

StatusFileSize
new34.14 KB

following up:

profile.module at #19 above falls into the warning below when posting a node:

warning: implode() [function.implode]: Bad arguments. in /accounts/lucamarino/www/jayculture.it/modules/profile/profile.module on line 591.

as an array was not declared.

Attaching the revised module below.

daniorama’s picture

Trying it on D6...

Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

jsaints’s picture

Status: Needs work » Needs review
StatusFileSize
new9.01 KB

I created a patch for the latest head that adds "checkbox group" as a field type to the profile module. The patch includes a test for the checkbox group (I would like feedback on it).

It applies cleanly to latest head and passes all tests. Please review.

This is a straightforward patch that will be a useful feature for many others.

jsaints’s picture

StatusFileSize
new9.04 KB

updated patch. Found a bug where $options was not initialized to array().

Status: Needs review » Needs work

The last submitted patch failed testing.

Equ’s picture

How about checkboxes for D6 profile module?

mittalpatel’s picture

It's showing options of other checkboxes.
For example if there are two checkboxes groups. 1 with options of Red, Blue and Green and another with options of Earth, Pluto, Saturn.
Then in either of the groups it will show all the options Red, Blue, Green, Earth, Pluto, Saturn.
Is there anything wrong I am doing? Or is it a problem of code it self???

daniel wentsch’s picture

Subscribing.
Has anybody been succsessful patching profile.module of D6 yet?

stevekerouac’s picture

Version: 7.x-dev » 6.12

Subscribing. Just updated from D5 to D6 and realised I had this running on 5.

oneoftwo’s picture

Version: 6.12 » 7.x-dev
Status: Needs work » Needs review
StatusFileSize
new10.45 KB

Since I really need this feature (as well as #124348: Multiple Select List addon) on my site, I rewrote/combined/updated my own 5.x module for the purpose, the one provided here by jsaints, and gonzalez_ea's from the other feature request thread (most of the credit is due for those guys, not me). Here is my first attempt at a combined patch. Any input and corrections, especially in the pages.inc and .test parts, is very welcome.

PS: this thread needs to stay at 7.x, since no new features such as this will go into the 6.x series...

Status: Needs review » Needs work

The last submitted patch failed testing.

oneoftwo’s picture

Status: Needs work » Needs review
StatusFileSize
new10.47 KB

sorry, wrong version uploaded before... any input on remaining exceptions would be very much appreciated.

Status: Needs review » Needs work

The last submitted patch failed testing.

oneoftwo’s picture

Title: Support for checkbox groups as a profile field type » Support for checkbox groups and multi-select lists as a profile field types
Status: Needs work » Needs review
StatusFileSize
new10.33 KB

new and improved... now it definitely works on my drupal 7 installation (including the pages.inc part); only the test module is still questionable, mainly since i can't get simpletest to behave.

Status: Needs review » Needs work

The last submitted patch failed testing.

lilou’s picture

Status: Needs work » Needs review
+  function getInfo() {
+    return array(
+      'name' => 'Test checkboxes field',
+      'description' => t('Testing profile module with add/edit/delete a checkboxes field') ,
+      'group' => t('Profile'));
+  }

should be :

+  public static function getInfo() {
+    return array(
+      'name' => 'Test checkboxes field',
+      'description' => 'Testing profile module with add/edit/delete a checkboxes field',
+      'group' => 'Profile',
+    );
+  }

^ public static, t() and coding standard of array.

lilou’s picture

Status: Needs review » Needs work

cross-post with testbot ;-)

oneoftwo’s picture

Status: Needs work » Needs review
StatusFileSize
new10.65 KB

thanks very much! with this, today's HEAD and some very minor simpletest hacking, i could finally run the tests. so after some debugging, here's the new version, which should pass all the tests (because the tests now finally do the stuff they should do).

the one thing i'm most unsure about is the following code snippet from the test module, where the array keys might be incorrect (although it works this way as well...)

    // Select 2 of the 5 list items
    $edit = array(
      $field['form_name'] . '[]' => array(
        2346 => 2346,
        2348 => 2348,
      )
    );

as always, help is very much appreciated!

oneoftwo’s picture

StatusFileSize
new9.98 KB

Update in the profile.test part: more comments, less code (by merging the rather similar test classes for checkbox groups and multiselect lists into one).

webchick’s picture

Status: Needs review » Closed (won't fix)

Shoot. :(

We finally got someone to code this up for a Drupal development version during a code thaw! With test coverage, even!! But unfortunately, this is the release where we got Field API in core, which means that if all goes well, Profile module will effectively be going away in favour of using Field UI to attach fields to users, including checkboxes and multiselect boxes. I can't really justify committing this patch when we need efforts to go around things like an upgrade path to field API from Profile module, rather than adding more features to Profile module.

The good news is that if you download and install CCK right now, you can add any fields you want to users, including checkboxes and multiselects. :)

But with regret, I have to mark this won't fix. :( Please keep up your great work in other Profile module patches though. It'd be great to get this cleaned up to make the migration easier.

oneoftwo’s picture

StatusFileSize
new6.21 KB

No worries, as long as functionality exists, I'm happy :) .

In that spirit, I'll just leave my D6 port of the patch here for people to use until D7 is here.

ignition25’s picture

UPDATE: works great! I also added a 'radios' type

mohamed_e’s picture

Thanks for the great work! As I am not a programmer and depening on others, one question: When I have to implement this feature in a running site now, which way should I go? CCK 6.x does not provide this (yet) in such a way as far as I know. However, when I implement this patch now, it does not get supported in future, so it is not a great way to go... Any suggestions?

oneoftwo, what is the way you go?

Thanks a lot for any insights ans suggestions!

mohamed_e’s picture

Does somebody know which module/patch does provide the 'Languages spoken:' like here on the drupal.org site? It also has also multiple select in which I am interested in. Thanks a lot in advance!

orb’s picture

Version: 7.x-dev » 6.14
Assigned: Unassigned » orb
Category: feature » bug
Status: Closed (won't fix) » Fixed
StatusFileSize
new6.18 KB

Removal in checkboxes inactive points.
It is necessary for use of fields of a profile in tokens.

ps. fix -> checkboxes_33044_multilist_124348_D6.patch

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

MattBrigade’s picture

The good news is that if you download and install CCK right now, you can add any fields you want to users, including checkboxes and multiselects. :)

Is this referring to Drupal 6 or 7? I'm in 6 right now and can't see where I can add multiselects to users using CCK? Or does this require the "Content Profile" module?

Thanks!

HGabi-1’s picture

Version: 6.14 » 6.16
Assigned: orb » HGabi-1
Category: bug » support
Status: Closed (fixed) » Active

Good afternoon,

please can anybody help me to write a views handler for the checkbox group and multi selection list? The checkboxes_33044_multilist_124348_D6.patch (#49) works very well, but after select one item of the view, there is no result. I need a views handler, which will give me the result after select one item.

Best thanks and regards.

rituraj.gupta’s picture

grendzy’s picture

Status: Active » Closed (won't fix)

Per webchick's comments in #48 (for Drupal 7), marking as "won't fix". This proposed change is also not suitable for Drupal 6 since new features are not added to stable releases (see http://drupal.org/node/10262 ).

alan d.’s picture

Version: 6.16 » 7.x-dev
Assigned: HGabi-1 » alan d.
Category: support » feature
Status: Closed (won't fix) » Active

Mmmm... Isn't fieldable Profiles a Drupal 8 feature now? As such, should we be lacking this primitive functionality from Drupal core for another 2 to 4 years?

Watching profile2 project (http://drupal.org/project/profile2) with interest to see if we can finally have a nice to use / extend profile module in Drupal. [Someone should close http://drupal.org/node/798648 if it gets in :)]

moshe weitzman’s picture

Users are fieldable in D7. Or sites can create a new Profile entity and field that. So, we have two better solutions than profile for D7.

damien tournoud’s picture

Status: Active » Closed (won't fix)

The profile module is obsolete. Won't fix.

adityadubay’s picture

Status: Closed (won't fix) » Needs review

Status: Needs review » Needs work

The last submitted patch, profile.module-support-checkboxes-multilist-#33044.patch, failed testing.

grendzy’s picture

Status: Needs work » Closed (fixed)

Please do not reopen this issue.

linuxeasy’s picture

StatusFileSize
new8.84 KB

Hi All,

This is a bit customization on http://drupal.org/project/profile_checkboxes

which makes multiple-select-box on profile page Working.

Sorry as i dont know about creating a patch, i have posted a complete module with customization which can be directly enabled/disabled.

This module if used is a fully working and tested one!

Usage is same as you would use profile_checkboxes module. It give you a fourth option of creating a multi-select list-boxe when you create a new profile file which is usually yoursite.com/admin/user/profile/add/selection (see at bottom of this page after module installation).

Please find this module customized at http://drupal.org/files/issues/profile_checkboxes.zip

Thanks!
Linuxeasy!

grendzy’s picture

linuxeasy - this issue is closed - perhaps you meant to post in the profile_checkboxes queue?

http://drupal.org/project/issues/profile_checkboxes?categories=All