This patch adds a 'multiple select' checkbox to the 'list selection' field type interface, allowing users to select multiple items from a single list. It looks the same as the 'multiple select' checkbox used during vocabulary creation.

Field values are stored separately in the profile_values table and thus don't need to be serialized, keeping search functionality in tact.

Note: this patch is not intended for 4.6.

Comments

matt westgate’s picture

StatusFileSize
new10.22 KB

Woops, full patch including database updates.

matt westgate’s picture

StatusFileSize
new10.33 KB

Fixing an uninitialized array.

matt westgate’s picture

Title: Multiple select functionality in profile module » Multiple select functionality for profile module
StatusFileSize
new11.73 KB

Cleaned up and ready to go for HEAD.

nevets’s picture

In the function profile_form_profile() for the case 'selection' need to initialize the array options.
It would look something like this

      case 'selection':
      	$options = array();
        $options[-1] = '--';

Without this if a catagory has more than one select list each list builds apoun the previous one.

Uwe Hermann’s picture

Status: Needs review » Needs work

Patch doesn't apply anymore.

anarcat’s picture

Title: Multiple select functionality for profile module » Fixed patch for 4.6.3
Status: Needs work » Needs review
StatusFileSize
new7.17 KB

Here's an updated patch that should apply cleanly on a 4.6.3 tree.

Note that we had to do this request to have the thing work at all:

ALTER TABLE `profile_fields` ADD `multiple` INT( 2 ) DEFAULT '0';

anarcat’s picture

Title: Fixed patch for 4.6.3 » Multiple select functionality for profile module

Oups! Sorry I messed with the title. :)

moshe weitzman’s picture

Status: Needs review » Needs work

patches should be against head or else CVS team will not review.

anarcat’s picture

Status: Needs work » Needs review
StatusFileSize
new8.35 KB

Trying again, this time against HEAD. Note: I haven't tested the patch, but it should work provided the API changes in form functions didn't change associated functionality and I didn't get confused by the new stuff. :)

I'm sorry I don't have time to test this right now, but at least we have something to work with...

cb921’s picture

This line in the patch seemed to be causing a crash on my 4.7 setup:

+ $form['fields']['multiple'] = array('#type' => 'checkbox', '#title' => t('Multiple select'), '#default_value' => $edit['multiple'], t('Allows users to select more than one item in this field.'));

I added '#Description' =>

+ $form['fields']['multiple'] = array('#type' => 'checkbox', '#title' => t('Multiple select'), '#default_value' => $edit['multiple'], '#Description' => t('Allows users to select more than one item in this field.'));

and the crashing ended, and it works fine and dandy.

What I am trying to do is much the same as what you have done here, but I want the multiple select's interface to the user, to be a set of checkboxes in two columns. I'm going to keep trying on my profile.module to do this, and if I actually succeed, I'll upload the patch file. If not, which at my level of cluelessness seems likely, then consider this a loser feature request from a dude who is not contributing yet.

cb921’s picture

As checkboxes, already exists.
http://drupal.org/node/33044

moshe weitzman’s picture

Status: Needs review » Needs work

doesn't apply cleanly

__Tango’s picture

Status: Needs work » Needs review
StatusFileSize
new7.75 KB

Fixed patch so it applies cleanly to today's version of profile.module in CVS (version 1.132).

moshe weitzman’s picture

Version: x.y.z » 6.x-dev

sigh - setting to drupal6. someone please resubmit this :)

moshe weitzman’s picture

Status: Needs review » Closed (duplicate)

lets close this and continue at http://drupal.org/node/33044 since that has a working patch for 4.7

migas’s picture

Is it possible to deliver a patched version of profile.module? Plenty of frustrated hours for those who have to install "patch" and fail several times would not be necessary. Thank you, mike

Junesun’s picture

I absolutely need multiselect in my profiles, and for a very legitimate reason: users are supposed to select the languages they speak, the music styles they like, the interests they have from a pre-defined list (to keep it translateable) and I'm not going to create hundreds upon hundreds of checkboxes for that. So my heartfelt thanks to those who have worked on a solution here!

One more issue: with the patch I applied, i18n_profile can't translate the items from a multiselect selectbox anymore. I need to retain that functionality. Is anybody up to patching i18n_profile for this functionality? I can offer a small compensation, contact me.

jsaints’s picture

FYI, I for those following here... I just posted a related patch that uses a "checkbox group" instead of a multiple select field. The patch offers similar functionality to those offered here.

If the checkbox group works, we could easily modify the patch for multiselect boxes as well.

http://drupal.org/node/33044#comment-1134877

Thanks

Equ’s picture

I also need multiselect functionality in profile module. Any updates?

stephenrobinson’s picture

subscribe

stephenrobinson’s picture

I have resorted to looking at http://drupal.org/project/profile_checkboxes