Views Checkboxes: D6 & view 2 port

gagarine - October 13, 2008 - 21:50
Project:Views Checkboxes
Version:5.x-4.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hello,

Can you plan a port for D6?

Thanks

#1

infohbp - December 6, 2008 - 17:51

Subscribing. Anybody ??? It is possible ?

#2

fallsemo - December 26, 2008 - 23:27

Subscribing! Please patch!

#3

daneyuleb - January 11, 2009 - 01:45

Subscribing

#4

Mark Theunissen - January 14, 2009 - 17:54

I'm working on a patch now. It's pretty much done. Will probably submit it here tomorrow.

#5

netgenius - January 14, 2009 - 22:57

Shouldn't be too hard - differences in the Forms API but not much else. Sorry for not contributing but things are a bit bad at the moment and I can't afford to be involved in unpaid work (already doing too much of it elsewhere!)

Not related to D6 conversion, but see also http://drupal.org/node/225814#comment-994474 - the continue statement needs to be changed to continue 2.

By all means message me if you have questions about the existing code - I didn't write the original but did all the recent updates.

[edit, link now correct]

#6

Mark Theunissen - January 14, 2009 - 22:38

Cool no problem. I think the link you posted is wrong? What is this continue 2?

#7

netgenius - January 14, 2009 - 22:59

Sorry, yes that was the wrong link, should be http://drupal.org/node/225814#comment-994474 - now corrected above. "continue" is wrong (would have worked in C, but sometimes I forget that PHP isn't C !) -- should be "continue 2"

#8

Mark Theunissen - January 15, 2009 - 10:22
Status:active» needs review

Patch attached. It's working great in my testing.

The only thing that doesn't seem to work is the altering of the size of the list of options. All the code does is alter the physical size of the select list, not the number of options within it. I don't see how the code would have worked in Drupal 5 either...? It simply sets the '#size' property, instead of actually calling unset() on the actual options on the list.

Anyway, I don't need that feature and it seems like a bizarre one... why would I want to strip options indiscriminately out of my list??

I have split up the one monolithic function into 3 helper functions for the 3 separate tasks that the module performs.

(1) remove the "none selected"
(2) alter the list size
(3) replace the selects.

I also modified the code to meet Drupal's coding standards, added function header comments, etc.

AttachmentSize
views_checkboxes-upgrade_to_d6-320800-8.patch 13.06 KB

#9

netgenius - January 15, 2009 - 19:23

Sounds good. I'll try to make time soon to get in via CVS and create a D6 dev release based on your patch.

The only thing that doesn't seem to work is the altering of the size of the list of options. All the code does is alter the physical size of the select list, not the number of options within it.

That's what it's meant to do - to alter the display size of the list, not change the number of elements. e.g. if you have some radios/checkboxes but also a list with, say, 20 items in it, you might well want to limit the size (height) of the list to 10 elements in order to fit the display size required by the radios/checkboxes - see what I mean?

#10

Mark Theunissen - January 16, 2009 - 09:48

Ahh ok. I find the help text a bit misleading:

When using a select-list, display only this many entries. Enter zero to use Views default.

I guess the key word is "display". But obviously not one else has found it a problem so no worries... ;)

#11

detot - January 28, 2009 - 22:16

Subscribing

#12

Mark Theunissen - January 30, 2009 - 09:05

Anything further on this? Could you make a release please?

#13

Chris Charlton - February 6, 2009 - 18:04

Subscribing.

#14

drupal mind - February 6, 2009 - 20:42

i have made module after patching it manually. here i will upload anybody can test it and purify and upload to project.

AttachmentSize
views_checkboxes.zip 9.56 KB

#15

drupal mind - February 6, 2009 - 20:45

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sorry upper module i have patch is now drupal 6 module, and all credit goes to Mark Theunissen who create a patch for it

#16

Kripsy - February 14, 2009 - 11:32

The limit doesn't appear to be working with a select box I have that has 20+ options not being properly ignored no matter what I set the limit to. It also appears to be removing the option from all taxonomy lists, even ones which are not being turned into checkboxes.

#17

marcvangend - April 7, 2009 - 12:47

Thanks for the patch. A first initial test works great for me, I will report bugs later if I find any.

#18

mat. - April 8, 2009 - 15:15

subscribed :-)

#19

saml - April 18, 2009 - 12:40

I have installed the module attached by drupal mind, but dropdowns and selectboxes haven't changed to checkboxes, and I can't find any relevant configuration settings in the views settings.

Am I missing something?

#20

saml - April 18, 2009 - 12:45

Sorry, reading the README I found out that I have to activate the module in administer > settings > views checkboxes
Can't understand how I could miss checking for such a page.

#21

John Money - April 19, 2009 - 15:34

+1 on patch http://drupal.org/node/320800#comment-1201900

Note that it is patched against 5.x-4.x-dev (2008-Jul-04).

#22

momper - June 24, 2009 - 09:05

it would be wonderful/important to have this configurable on per view basis ...

thanks for your efforts ...

#23

rkahlert - July 4, 2009 - 12:29

With this module a selection is required, because if no checkbox is checked the query runs like 'WHERE foobar IN(0, 0, 0, 0...)' and no results are deliverd.

#24

momper - July 7, 2009 - 11:41
Title:D6 & view 2 port» Views Checkboxes: D6 & view 2 port

#25

j0k3z - July 9, 2009 - 18:17

Would love this feature in Drupal 6...

#26

j0k3z - July 9, 2009 - 18:29

It would be nice to set this option on a per field basis.

I want checkboxes to show as checkboxes in views but to keep dropdowns the way they are. The provided patch seems to change all dropdowns and checkboxes to radio buttons.

#27

j0k3z - July 9, 2009 - 18:55

Also, as rkahlert states above, a selection is required, which isnt ideal. Checkboxes are optional by nature, so how can we fix that?

#28

rhg108 - July 15, 2009 - 21:58

I agree with rkahlert and j0k3z that having to make a selection is problem. Is there some way that all choices could be selected if the user doesn't select anything?

#29

j0k3z - August 4, 2009 - 00:50

any updates?

#30

brad bulger - August 16, 2009 - 01:43

it looks to me like the issue with not checking any box not working the same way as not selecting any option in a select field is some kind of unfortunate intersection of the Forms API and the way views handles multiple-value arguments. i think it's related to the way that each checkbox's name will be "filter0[keyvalue]" while the select field's name is "filter0[]" - the value of "filter0" ends up as an array of zeroes for the checkboxes.

i was able to hack my way around this by adding a validation function that strips those zeroes out of the values:

function views_checkboxes_validate_checkboxes($element, &$form_state) {
  $form_state['values'][$element['#name']] = array_diff($form_state['values'][$element['#name']],array(0));
}

i set it up after the line that sets #type to 'checkboxes':
$form_element_obj['#type'] = 'checkboxes';
// add hacky validation function to remove unwanted values
$form_element_obj['#element_validate'] = array('views_checkboxes_validate_checkboxes');

i'd hope there is a better way to do this.

#31

ashiwebi - August 17, 2009 - 11:07

I downloaded the patch but it is not showing any option in views filter.

How I can limit number of entries in the filter options to check its functionality as mentioned in readme file.

Any help is appreciated

#32

edemus - September 7, 2009 - 17:06

unfortunately, i cannot get this working with multi-select checkboxes. Works good, when i check 'force single'

#33

Bacteria Man - September 18, 2009 - 04:23

What's the status of the D6 port? I have an immediate use for this module, but would definitely need multiple choice support. I also need a default "All" checkbox (like when using an optional multi-select) or perhaps a check/uncheck all JavaScript function.

#34

netgenius - September 18, 2009 - 12:10

I've (finally!) created a D6 dev branch based on Mark Theunissen patch in #8 above. I've not had a chance to test it myself yet, but from comments above it seems to work well. Does anybody have a live installation working?

#35

Bacteria Man - September 18, 2009 - 18:17

For people looking to display multi-selects as checkboxes Better Select is a viable option. Unfortunately it's not perfect either as there are issues with taxonomy exposed filters.

#36

dafeder - October 23, 2009 - 18:41

Netgenious, thanks, I've gotten it working and haven't noticed any quirks so far, but it is much more intuitive when making the modification suggested in #30.

#37

brad bulger - October 24, 2009 - 00:22

in the end, i found that in d6 it was easier to create a theme template file for the exposed view filter form and just print out checkboxes based on the options value for what would have been the select field. we only needed this to work on a few views, with fairly simple filters. i imagine this might be a troublesome approach in a more complex situation. but i thought it might be a useful suggestion for some people.

#38

design.er - November 7, 2009 - 02:43

Hello,

Since the upgrade from Views 6.x-2.6 to 6.x-2.7 the checkboxes are no longer working for me -> I see the normal Views select list.
merlinofchaos writes in the relase notes of 6.x-2.7 that some field renderings have been changed and it may be that this will affect the output/style of some views-related modules. I think this is happening here.
It would be great if somebody could look into this.

Of course, I will help to test and report back.

Thank you and kind regards,
Stefan

#39

ryumkin - November 10, 2009 - 16:08

I'm asking maintainer to check my module. Hope that will help to make a D6 version based on my module. The code is very simple. I've made it for Views 2 and didn't check it with other.

AttachmentSize
exposed_checkboxes.zip 1.01 KB

#40

netgenius - November 12, 2009 - 19:20

@ryumkin I've taken a quick read through your code and it's looks good, but I don't really have time to test it right now, sorry. Could somebody else here do that? As far as I can see it only deals with checkboxes, not radio buttons.

#41

ryumkin - November 13, 2009 - 08:00

It also deals with radios, but the radios didn't have a problem with "all unselected null result", so I've changed just a style.
It's looking like nobody is interested this theme :(

#42

design.er - November 13, 2009 - 13:21

Hi Ryumkin,

Thanks for the pm and the new module.
Unfortunately I couldn't get it up & running with Views 6.x-2.7. It's the same problem as with the current version of views checkboxes 6.x-1.x-dev -> I only see the label (of exposed filter) and button "Apply" but no checkboxes. If I uninstall the module I can see the normal list of the exposed filter. So it seems to be a problem of the plugin.

I attached a screenshot to clarify the problem.

Did you test it with the Views 6.x-2.7 yet?

Regards,
Stefan

AttachmentSize
views_exposed_filters.png 45.74 KB

#43

ryumkin - November 13, 2009 - 19:29

Ok, I see... I thought that I've got the last version. I will upgrade my module as soon as possible.

EDIT: Hm... Actually I've set a new 2.7 version and my module still works. My module I so simple so I can't even imagine a fault.
Could you please try to disable View module and enable it again? And also did you navigate to update.php during upgrade to 2.7 version process?

EDIT 2: Ok, I've found the problem... Your filter is a node type filter, I've never been tested my module with such filter. Yes it's really don't work with it. I will study and let you know. I will also study taxonomy filter.

#44

ryumkin - November 14, 2009 - 11:28

Ok! So here we go... Please try this one, it looks fine, even taxonomy working.
Please note that if you were referencing the GET type links like http://www.bla-bla-bla.org/myview?option1=10&option2[]=uno
than you must revise them because checkboxes logic differs select logic, please be careful.
You can use the following style to make the checkboxes with the scroll, that's simple:

div.views-exposed-form div.form-checkboxes,
div.views-exposed-form div.form-radios
{
background:#fff;
border:1px solid #999;
overflow-y:auto;
max-height:10em;
margin:0px;
width:100px;
}

AttachmentSize
exposed_checkboxes.zip 1.03 KB

#45

design.er - November 14, 2009 - 12:08

Thank you for the new version. That's a big step in the right direction. The checkboxes are visible now.
I'm not sure if the problem I currently have is the same you've pointed in your comment from #43. In Views I deactivated the "optional" and "force single" settings for exposed filters so all checkboxes should be activated by default. Checkbox are active by default but they seem to work as deactivated because no events appear on the calendar. Only if I deactivate all checkboxes and activate only one I can actually see events for this one activated checkbox. If more than 1 checkbox is active nothing appears.

Hopefully I could point the problem clear enough. Please let me know if you need more info.

EDIT: I found out that if more than one checkbox is active always only the content of the last checkbox in the URL is visible - the content of all checkboxes before is going to be ignored. And of course if the last checkbox has no content, nothing is visible.

#46

ryumkin - November 14, 2009 - 14:27

Ok, I'm confused... Activating "force single" for Views is the mark for my module to show the filter like "radios".
If you're ready to move forward, maybe I'll make the public version on one of my domains in English, and we will force this mistake with your help?

#47

design.er - November 16, 2009 - 09:22

You're right, for "radios" it is necessary to activate "force single" but not for checkboxes. I thought your module supports also checkboxes?
Please let me know how I can be of service to get things up & running correctly.

#48

ryumkin - November 16, 2009 - 13:08

yes, sure it supports checkboxes. I'll back to you when I will make the test website.

#49

design.er - November 16, 2009 - 15:45

Great, I'm looking forward. :)
Thanks a lot for your time & passion.

#50

ryumkin - November 17, 2009 - 13:51

So here is the new version. Please try it.

AttachmentSize
exposed_checkboxes.zip 1.03 KB

#51

design.er - November 17, 2009 - 14:20
Category:feature request» task

Awesome, both checkboxes and radios work like a charm now. Great job! :)

@nschelly: What's the next step? IMO this version is stable now but maybe somebody else could test it to get more than one opinion.

Thanks a lot for your work ryumkin!

#52

Bacteria Man - November 18, 2009 - 23:55

I just took the newest version posted in #50 for a test drive. I appreciate the effort, but there are still issues to sort out.

The Good

Radio buttons work as expected, replacing a "force single" filter dropdown.

The Bad

Checkboxes do not work. More accurately the view doesn't load and instead just hourglasses. My node reference filter contains over 50 items, which could be part of the problem.

The Ugly

It seems all exposed filters change to radio buttons/checkboxes even when a single/multiple select input is desired. Is there a way to set the preference per exposed filter? I would expect to see an option on the filter configuration page (exp. "Use radio buttons/checkboxes").

#53

ryumkin - November 19, 2009 - 20:40

What Views module version do you use?

#54

Bacteria Man - November 20, 2009 - 07:09

Drupal 6.14, Views 6.x-2.7

I did some further testing and can now confirm that checkboxes do indeed replace a multi-select filter (i.e. when "force single" is unchecked) and the selections are recognized and processed as expected. However an excessive number of options causes the page to load extremely slow.

It would seem (to me anyway, as per my previous suggestion) the only missing ingredient now is the ability to set the on/off radio button/checkboxes preference per exposed filter.

In any event kudos to you for getting this far!

#55

ryumkin - November 20, 2009 - 07:16

I don't know how about select, but checkboxes had bad perfomance, when their quantity grows up.
In my web applications I was always trying to make their load partically with Ajax, but in filter it's impossible.
I think that option on/off will be the best solution, I will put it into a new version.

#56

Bacteria Man - November 23, 2009 - 22:11

Here's one other bit of weirdness.

I defined the following options:

0|Period 0
1|Period 1
2|Period 2
3|Period 3
4|Period 4
5|Period 5
6|Period 6
7|Period 7
8|Period 8
9|Period 9
10|Period 10

The default multi-select filter works as expected, but as checkboxes the option "0" selection doesn't "take" (i.e. doesn't properly filter content and isn't checked after submission). Presumably this is because the system sees it as an empty value.

#57

marcvangend - November 27, 2009 - 08:48

Sorry, but I'm a little confused. Coming back to this topic after half a year, I see that the focus has shifted from views_checkboxes.module to exposed_checkboxes.module. Is this a replacement, an addition, or something completely different? If I want the functionality of Views Checkboxes in Drupal 6, what should I use?

#58

kervi - December 15, 2009 - 12:28

maybe version for views 3.0?

 
 

Drupal is a registered trademark of Dries Buytaert.