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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | multiselect_experimental_fapi.patch.txt | 698 bytes | jp.stacey |
Comments
Comment #1
attheshow commentedDear 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.
Comment #2
patchak commentedOhhh that is awesome news!! How about a glass of Champagne in Paris in sept?? ;)
Patchak
Comment #3
attheshow commentedComment #4
attheshow commentedComment #5
jp.stacey commentedHi,
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
Comment #6
attheshow commentedIt'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.
Comment #7
liquidcms commentedtoo 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.
Comment #8
liquidcms commentedwhere 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
Comment #9
liquidcms commentedok, 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:
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??
Comment #10
gbernier commentedHas 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
Comment #11
attheshow commentedFAPI integration is complete for D7 dev version. Just need to backport this to D6 version.
Comment #12
gbernier commentedAwesome, looking forward to seeing it backported and trying it in D7
Comment #13
attheshow commentedOk, 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.