Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have 3 different fields assigned to 3 different select list options.
field 1 is dependent on option 1
field 2 is dependent on option 2
field 3 is dependent on option 3
There are 6 options in the select list.
When the form loads, none of the dependent fields are hidden.
When I select option 1 for the 1st dependent field that was added, both field 1 and the select list itself disappear.
When I select the 2nd or 3rd options, field 1 disappears.
When I select an option without a dependent field, both field 1 and the select list itself disappear.
No errors appear in the javascript console.
Comments
Comment #1
Gidgidonihah CreditAttribution: Gidgidonihah commentedThis is why I dislike not being able to edit the first post.
The obvious spelling error should in fact be 'disappears'.
Comment #2
Tamar Badichi-Levy CreditAttribution: Tamar Badichi-Levy commentedI will try to see if I get the same behavior in my test site.
Can you please upload your CCK export text?
BTW, what version of jquery are you using? I'm using the 1.2.1 vesrion from the 'jquery_update' module.
Comment #3
Gidgidonihah CreditAttribution: Gidgidonihah commentedI modified the content design to due this and went live, so I can't export. I'll try to recreate on the test site.
As for which version of jquery, I'm not sure, but it is quite old.
I'll see if I can recreate, update jquery, and get back here with my results.
Thanks.
Comment #4
Gidgidonihah CreditAttribution: Gidgidonihah commentedOk, I recreated everything and confirmed the error was still there.
Another odd thing I noticed which occured before i played with weights (though I don't know why that would affect it)
Was that at one point it hid the title field.
Continuing on, I installed the jquery_update module.
Errors persisted.
Then after I realized I left out a pretty significant factor in the bug report, I figured I better test that out.
Recreated the same as stated in the first post using a select list and 3 text fields.
Everything worked perfectly.
The problem is, that I was trying to hide date fields. Everything works as should with text fields, but the problem occurs when the fields to be hidden are date fields.
And it took me a minute to figure out since I didn't have the content copy module enabled, but here's the export text:
Comment #5
Tamar Badichi-Levy CreditAttribution: Tamar Badichi-Levy commentedI imported you cck type but I still cannot reproduce this bug. What versions of this module and "Date" module are you using? What other cck modules are you using?
Comment #6
Gidgidonihah CreditAttribution: Gidgidonihah commentedOh, right I neglected to mention that I'm using Date 5.x-2.x-dev
(gasp! dev in a production enviornment?! I know, but it has the features that were mission critical.)
Other CCK modules enabled are:
Address Field 5.x-2.1
Computed Field 5.x-1.2
Content Taxonomy 5.x-1.x-dev
Content Taxonomy Autocomplete 5.x-1.x-dev
Content Taxonomy Options 5.x-1.x-dev
Dependent 5.x-1.4-beta
EMail 5.x-1.x-dev
Fieldgroup 5.x-1.7
ImageField 5.x-2.1
Link 5.x-2.3
Money 5.x-1.5
Node Reference 5.x-1.7
Number 5.x-1.7
Option Widgets 5.x-1.7
Text 5.x-1.7
Textfield Autocomplete 5.x-1.x-dev
Comment #7
Tamar Badichi-Levy CreditAttribution: Tamar Badichi-Levy commentedAre you using php5 and higher? My code is not compatible with php4 as far as I know.
Comment #8
Gidgidonihah CreditAttribution: Gidgidonihah commentedIsn't it more likely that the issue would be in the javascript and not the PHP since that's actually what's hiding the fields?
I was running 5.1 and just upgraded to 5.2. Haven't tried it since the upgrade.
Comment #9
Tamar Badichi-Levy CreditAttribution: Tamar Badichi-Levy commentedCab I mark this issue as fixed?
Comment #10
Gidgidonihah CreditAttribution: Gidgidonihah commentedI would say no. It's a bug that hasn't been fixed. Granted I decided against deploying like this, but that was because of this bug. I'd still love to help you fix it.
I imported the content type I listed above into a test environment. Like I said, it's not a php problem. We've upgraded to php5 and everything is exactly the same.
It looks like the problem lies with the JS and Date-5.x-2.x elements.
I set it up with text boxes and address elements (cck address) and it works like it should.
It's the date, however, that causes a problem:
There are no JS errors unless a date element is dependent. When added 1 dependent date element I got the following JS error on page load:
On page load, all dependent items are visible. Lets say I have options A, B and C. I have a text box dependent on A, address dependent on B and the date dependent on C. If I select A, the text box and address disappear as does the select box itself. If I select B, the same thing happens. If I select C, the text box and address disappear but the select box does not. The date never disappears.
Then I deleted Date 5.x-2.x and tried the same thing with Date 5.x-1.x. Everything works beautifully.
Looks like the issue is when we're working with Date 5.x-2.x.
Now I don't know if this is something in your code that needs to be fixed, or the date code. Where should we go from here, maybe you get with KarenS about it?
Comment #11
Tamar Badichi-Levy CreditAttribution: Tamar Badichi-Levy commentedSorry for not being around. I was on vacation in Namibia. A great landscape. However, It is really interesting, I use date fields and it works like a charm. Can you give me a link to this page? I would like to debug the javascript code.