I have several users complaning that it's difficult to select the post's audience easily when we have more than 20 - 30 groups... I agree with them but I don't really have a solution to offer them..

I thought about this module cause it would be awesome to use this as a Audience Selector for OG, since it makes it easier for users to select using this widget than to actually select CRTL and then scroll, etc...

I was wondering if the maintainers would be interested in having a look at this feature??

Thanks a lot,
Patchak

CommentFileSizeAuthor
#5 multiselect_experimental_fapi.patch.txt698 bytesjp.stacey

Comments

attheshow’s picture

Assigned: Unassigned » attheshow
Category: feature » task

Dear Patchak,

Good idea. Moshe Weitzman (creator/maintainer of OG) actually expressed interest in this a little over a year ago (see #194004: Generalize for any select form element). It seems possible to me, but I'll need to do a bit of research. I'll post any updates on this issue here.

patchak’s picture

Ohhh that is awesome news!! How about a glass of Champagne in Paris in sept?? ;)

Patchak

attheshow’s picture

Status: Active » Postponed
attheshow’s picture

Assigned: attheshow » Unassigned
jp.stacey’s picture

Title: Use this module with OG ? » Use this module with OG and non-CCK form API generally?
StatusFileSize
new698 bytes

Hi,

I've been trying to make this work for OG. The key is clearly to get it to work as a non-CCK form API element, and I'm so close I can smell it, but still not quite there.

The overriding issue is that things like the _process function (which should be pure FAPI) depend on a lot of CCK-like functions e.g. optionwidgets_options . This should arguably move out into one of the _widget_ hooks. I can get as far as turning the OG groups element into a multiselect, and having the groups appear and work in the browser, but form submission generates the all-too-familiar "An illegal choice has been detected", and the right-hand select box highlighted in red, which suggests that the CCK validation is still kicking in somehow and trying to check the optionwidget options rather than #options.

Experimental patch attached: comments welcome.

J-P

attheshow’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Assigned: Unassigned » attheshow

It's starting to look like we might get this Form API change in place for the D7 of the module, but it probably won't happen for D6.

liquidcms’s picture

too funny.. been trying to sort out in my head the basic question "do cck form element modules extend FAPI?" as i would really like to use ms_select in a custom form.

surprised to see i could actually just add an element with #type = multiselect_select and the element seemed to be there. but it wouldn't retain my #options. debugging code a bit i came to the conclusion that your code was wiping #options and making this tricky.. but this patch is exactly what i thought might be needed.

now to see if i can work around the validation issue you are referring to.

liquidcms’s picture

where you convert the field to a select you have this:

'#options' => $selected_options,

making that

'#options' => $unselected_options,

fixes the "An illegal choice has been detected" issue

but my submit function loses all but the last value moved to $selected

liquidcms’s picture

Component: Code » User interface
Status: Active » Postponed

ok, my point in #8 is not valid.. and i think the patch jp provides in #5 does make this work in FAPI, but when i set this up i forgot to add #multiple in my field set up

this seems to work correctly:

    $form['players']['players'] = array(
      '#type' => 'multiselect_select',
      '#title' => "Past Team's Players",
      '#options' => $players, 
      '#multiple' => true,
    );

note the module hard codes the post to use the var "uid" which might screw up if you are actually sending that as another field - possibly something in the field definition could be set to change that??

gbernier’s picture

Has any further work been done to make this work with FAPI? To take it a step further I need this exact FAPI element and want to add AHAH to it. Just found this today and hope it will get to where it can added to any form

attheshow’s picture

Component: User interface » Code
Status: Postponed » Active

FAPI integration is complete for D7 dev version. Just need to backport this to D6 version.

gbernier’s picture

Component: User interface » Code
Status: Postponed » Active

Awesome, looking forward to seeing it backported and trying it in D7

attheshow’s picture

Status: Active » Closed (fixed)

Ok, as of now, I'm no longer planning to backport the FAPI integration. It's a feature in the D7 version though. If anyone else wants to submit patches to backport, please feel free.