Active
Project:
dependantDropdown
Version:
5.x-1.0-beta
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2007 at 18:47 UTC
Updated:
17 Aug 2007 at 15:19 UTC
Jump to comment: Most recent file
Comments
Comment #1
Budrick commentedIve found that Drupal, would not accept values which were not included in $form array.
Also I did some changes to adopt module for my needs.
On my computer JS worked very slow - it took several seconds to refresh filtered field after changing filtering field (660 records car make/model list).
Also there were some problems with my own javascript - because every time filtered field were completely removed and recreated, therefore all references to the field were lost.
I changed the structure of JS array (in php), and optimised JS file.
Attaching changed module, maybe someone can find it usefull.
Comment #2
Budrick commentedIve found that Drupal, would not accept values which were not included in $form array.
Also I did some changes to adopt module for my needs.
On my computer JS worked very slow - it took several seconds to refresh filtered field after changing filtering field (660 records car make/model list).
Also there were some problems with my own javascript - because every time filtered field were completely removed and recreated, therefore all references to the field were lost.
I changed the structure of JS array (in php), and optimised JS file.
Attaching changed module, maybe someone can find it usefull.
Comment #3
Budrick commentedI missed setting the default value.
Comment #4
panchoFor me the autoselect doesn't seem to work with or without Budrick's changes...
On the content type config everything's all right:
In the slave field I selected the correct master field and added the following entries to the "allowed values list":
When I now create a node:
- No matter what I select in the master field, I see all entries in the slave field.
- The slave field gets lost when saving the node.
Did I do something wrong or what might be the problem?
Comment #5
Budrick commentedI dont know why slave field is getting lost.
To fix this I just added this function to dependantDropdown.module:
What JS error are you getting when changing master field?
In my case jquery.js were not loading. To fix this add:
Also try use no spaces in values list.
Comment #6
panchoThanks for following up!
Your question: I didn't get any JS error because there was no JS action fired at all, though jquery.js was already loaded. The space characters were not the problem either. And not even your method "dependantDropdown_nodeapi" helps - the value in field2 is still not being saved... :(
Additionally I figured out the following separate problems:
I now create a node. Everything works fine as long as I select "toyota" or "nissan" in field1. When I select "lexus", I'm of course presented no sub-options in field2 (which is correct). Now, if I switch back e.g. to "toyota", the selector remains empty until I reload the page.
key|labelis interpreted altogether as the key.If you can reproduce those errors, I will create separate issues for them.
Comment #7
Budrick commentedIf no JS action is fired, then body.onload might have been redefined by some other js code.
What about empty field - is it present in $_REQUEST if you print_r it?
And I nefer tried several fields or filters with no values in filtering field.
The module is rather raw, but at leas I've made it work for me.
Comment #8
green monkey commentedDrupal 5 - DDD V5 Beta
ouch .... Greetings all,
I have been trying to understand the prpoer setup for this module all day. I'm just not getting something right. Would someone mind offering a little advice?
Here's what I have to work with:
State: field_state
County: field_county
I set-up "State" as a Select List
with Allowed values list: (like this - example is shorter ver of course)
Alaska
Arizona
Arkansas
California
Colorado
Then I setup "County" as an Active Select
with Allowed values list: (like this - example is shorter ver of course)
Alaska,Adams
Alaska,Asotin
Alaska,Benton
Alaska,Chelan
Alaska,Clallam
Alaska,Clark
Alaska,Columbia
Alaska,Cowlitz
aqll that comes up for a choice in "County" is Alaska
what am I not doing correctly?
thanks
J
Comment #9
Budrick commentedJust invert your list:
Adams,Alaska
Asotin,Alaska
...
Comment #10
green monkey commentedthank you for your reply, I just can't get this to work and I can't figure out what I'm not doing correctly
I tired your post above, but its not working
I'm using 4.7 now - to see if I can get that to work
here's what I'm doing
field1 = field_one and is "Select List"
field2 = field_two and is "Active Select"
(field1 values)
one
two
(field2 values)
red,one
blue,one
green,two
yellow,two
It doens't matter if I select "one'" or "two" from field1 Select List,
I still see all choices for field2
firefox did trap an error for though
Error: Drupal is not defined
Source File: http://www.mywebsite.com/modules/dependantDropdown/dependantDropdown.js
Line: 55
I greatly appericate your help on this - it looks so simple - yet.............
Comment #11
Budrick commentedTry to add drupal.js, jquery.js.
Look for "drupal_add_js" above
Comment #12
f.mardini commentedhi,
I just can't seem to get it to work
The slave list contains all values and is not being updated on changes to the filtering list.
My set up is like this: Drupal 5 with latest dependantDropdown
Country (a select list with text values) with allowed values
France
Germany
Italy
etc.
City (an active select list)
filter according to field country,
allowed values:
Pairs,France
Berlin,Germany
Rome,Italy
etc.
thanks a lot
Comment #13
Budrick commentedFilter according to:
If the name of the master field is "country" it should be "field_country", if "Country" it should be "field_Country" etc.
What js error are you getting on page load, on master field change?
Did you try to add drupal.js, jquery.js as described above?
Comment #14
f.mardini commentedHi,
Thanks.
I included the javascript files as described above.
When i set the filter according to field set to field_country i get the following error: filteredField has no properties (caught by firebug).
When set to field_Country i get no errors but also no results :( the list does not change.
Comment #15
jsm174 commentedI was finally able to get this to work. I too was getting the filteredField javascript error. If your using Drupal 5.1, replace the dependantDropdown module with the attached version attached in message #5.
I believe the link is: http://drupal.org/files/issues/dependantDropdown_1.zip
I have a Select List field called field_series with allowed values list set to:
100|100
200|200
300|300
400|400
600|600
700|700
I then have a Active Select List field called field_models with allowed values list set to:
148W,100
152W,100
146W,100
155W,100
158W,100
260XW,200
257T,200
E361T, 300
361, 300
N361TL,300
Allowed values lists "Active Select List"s do not accept the pipe (|). So you can't use 148W|148W,100
Hope that helps,
-- Jason
Comment #16
larynI am getting this error when I try to use the file linked above and set up an Active Select based on a Select List:
Error: missing ] after element list
Source File: http://localhost/?q=node/add/contentitemname
Line: 150, Column: 151
Source Code:
var js_options={'Mac':['eMac','iBook','iMac-G3','iMac-G4','iMac-G5','iMac-Intel','PowerMac-G5','PowerBook-G4','MacBook-Intel','MacPro-Intel','Help-Don't Know'],
Comment #17
pushkar commentedAny help here?
Does it work for anyone? Developers- are you there? Please help!
Comment #18
pushkar commentedOk, so here is one 'bug' i think I found. I am using the standard STATE / CITY example with the following data set
- a Select List field called field_state with allowed values list set to:
100|100
200|200
300|300
400|400
600|600
700|700
I then have a Active Select List field called field_city with allowed values list set to:
148W,100
152W,100
146W,100
155W,100
158W,100
260XW,200
257T,200
E361T, 300
361, 300
N361TL,300
Allowed values lists "Active Select List"s do not accept the pipe (|). So you can't use 148W|148W,100
(borrowed from http://drupal.org/node/106401, commend #15)
In dependentDropdown.js, line 4 (the firebug catch),
I replaced it by (temporarily)
Notice that the value of
filteredFieldNameisfield_citybut the CSS has the element asfield-city(with hyphen instead of underscore).With this hack, I am able to save the options correctly (yay!). Of course this is specific. but may be this helps generate some interest and leads.
In addition, I think for the most part its a Javascript issue now. If someone can help write the parsing of the arrays and depdendt lists, we should be on the homestretch pretty soon.
Comment #19
pushkar commentedhttp://pushkar.chipin.com/drupal-dependent-dropdown-module
Chipin please!
note: I have limited skills. This is to get the bounty rolling for the first person who solves the problems and makes the module work for drupal 5.1 and drupal 4.7 AND RELEASES THE CODE FOR EVERYONE.
You cant see my $10 because i cant pay myself through paypal. But I will add it when I pay the bounty.
Comment #20
vanvemdenIt wasn't working for me and then I set the filtering field (in the example of pushkar field_state) to required in Content Management and guess what ... it worked!
Even without the
hack. Hope this helps somebody.
Comment #21
vanvemdenWhat I forgot to mention at comment #20 was that I used the module downloaded from comment #15.
Comment #22
sdsheridanI'm still having problems with this. I have the DDD working in the country-state scenario on a node-profile, but nothing is being saved back to the CCK table --- the column value is NULL. How did those who got this working get it to save back to the table?
If I can't get this working (or even if I can), I'm wondering if anyone has figured out another way to do this kind of dependent sub-select thing.