Active Select doesn't work properly with Category's (Category Module) Parent and Container propeties selection.

slybanshee - February 22, 2007 - 07:23
Project:Active Select
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:bdragon
Status:active
Description

Active Select doesn't work properly with Category's (Category Module) Parent and Container propeties selection. "Container" field reduced to one choice (current container that category belongs to). "Parents" field stays absolutely empty with no choice. Category module version 5.x-1.1

To reproduce:
1. Create Container1.
2. Create Category1 in Container1.
3. Create Container2 as child of Container1.
4. Set Container2 "Hierarchy" to multiple.
5. Set Container2's distant parents to both "this container" and "Container1" (without asterisk)
6. Create Category2 in Container2, try to set "Container" and "Parents" fields with Active Select enabled and disabled, feel the difference.

#1

VM - February 22, 2007 - 08:02

I can confirm this. I was just walking myself through the tutorial found here: http://drupal.org/node/74747

and cannot get the parent drop down to populate.

#2

VM - February 22, 2007 - 08:02

everyone once in a while I can get the parent drop down to disappear though.

#3

VM - February 22, 2007 - 18:47
Priority:normal» critical

marking this as critical since it doesn't seem to work under any circumstances. Just tried with newest release of category and still cannot get the parent drop down to populate.

#4

bdragon - February 22, 2007 - 23:38
Assigned to:Anonymous» bdragon

(assigning to self)

I'll be looking into the category+activeselect problems soon. Something's definately wrong with multiple hierarchy and Category...

#5

VM - February 24, 2007 - 00:45

Thanks bdragon!

#6

slybanshee - February 27, 2007 - 09:30

This issue is also submitted in category's bugs:
http://drupal.org/node/115582 - made that duplicate because bdragon already assigned this here.

#7

bdragon - February 27, 2007 - 22:54

Hmm, the code is trying to {for ... in} an array. Bad bad bad...

Still working on it..

#8

slybanshee - February 28, 2007 - 08:54

Thank you bdragon! Your work is very appreciated!
I've submitted one more issue on Active select: http://drupal.org/node/121047 It is concerning Internet Explorer behavior with Active Select. May be it would be suitable if you looked at this too (since you are digging the code by now). Number of users with IE still remain very large, so this bug becomes critical.

#9

Shane Birley - March 19, 2007 - 03:39

#10

knseibert - March 27, 2007 - 11:10
Status:active» needs review

Hi there,
i found a solution which is for now working for me.
In the category_activeselect() function line round about 1400:

$options = _category_category_select_options(...);
foreach ($options as $key => $value) {
  ...
  $options[$key] = ...
}
$output = array(... $options ...);

These lines of code result in a mix of the result of _category_category_select_options and the additional $options provided within the foreach statement.
IMHO the $output should only contain the options from within foreach.
I have just replaced $options with $select_options in the first 2 lines (_category_category_select_options(...) results and foreach) and what can i say. For the time beeing it works for me.

Patch attached. Feedback appreciated.

AttachmentSize
category_activeselect.patch 850 bytes

#11

inforeto - March 31, 2007 - 10:12

Patch worked. Thanks for solving one of my problems!
Since it is a small patch i didn't find anything else to review and hope it gets commited soon.

#12

Summit - April 7, 2007 - 09:27

Hi,
THis behaviour is also in 4.7.6.
Is this patch also working for 4.7.6?

greetings,
Martijn

#13

knseibert - April 7, 2007 - 09:54

Hi Martijn,
here's the patch for version 4.7. I just took a quick look at the code and it seems to be the same problem. However i did not test this patch.

AttachmentSize
category_activeselect_4_7.patch 897 bytes

#14

bdragon - April 8, 2007 - 04:25
Status:needs review» active

Patch from #10 committed to DRUPAL-4-7, DRUPAL-5, and HEAD.

Thanks!

--Brandon

#15

knseibert - September 19, 2007 - 06:26
Version:5.x-1.0» 5.x-1.x-dev

Problem still exists in current 5.x-1.x-dev CVS. Patch still valid.

#16

liquidcms - April 16, 2008 - 16:26

I am not using ASelect but i get the same issue when editing a container.

When i edit, the "Parents" field is unset. So when i submit i get "Parents field is required".

I only have the one option under Parents: root.

Pretty sure this was fixed back when i used cat module in Dr4.7. But it is back now for Dr5.7 and lastest dev version of cat module.

 
 

Drupal is a registered trademark of Dries Buytaert.