Are there plans to port this module to Drupal 6? It provides a great feature that I think is essential for a lot of types of sites. Let me know if I can help!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

peterpoe’s picture

Status: Active » Postponed

We'll have to wait for a stable release of CCK for D6, or at least a beta...

designerbrent’s picture

Version: 5.x-2.x-dev » 5.x-1.x-dev
Status: Postponed » Needs work
FileSize
68.66 KB

So I have started to upgrade the module. Attached you will find a patch against the 5.x-1.x-dev version. (I didn't know there was a 2.x version till just now!)

It is not fully working yet, though it does install the tables, and all the forms look like they work, it is not saving any of the settings.

If anyone has any hits as to why it is not getting called, please share!

Jiou’s picture

Subscribe

Roulion’s picture

waiting for it too

peterpoe’s picture

Good start designerbrent.

I did some study on the new cck. Seems that everything's changed. I don't have time to work on this now, so any help is greatly appreciated.

kenorb’s picture

subscribing...

jeff_bond’s picture

subscribing also. big obstacle for me moving to 6.x is not having this.

ianchan’s picture

This is a great module! Please port to D6.

batbug2’s picture

yeah, i'd like this baby in d6, too!

caugmar’s picture

Hi all,

I applied the conditional_d6_update.patch, did some changes of my own and now it saves the settings, but the rest still doesn't work: the controlled fields are not being hidden. Could someone spare some time and test my changes to see what I did wrong, or if my changes could be useful at all?

patchak’s picture

Hey Caugmar! Thanks for the work on this, I would like to sponsor the dev. on the drupal 6 version. I don't have much, but I am willing to donate at least 100$ for this, are you interested in continuing the work to make it work and release a beta release?

Any else interested in chipping in and sponsor dev of this module?

Patchak

caugmar’s picture

Hi,

It's working now, at least for my needs. I'm posting a patch with all the changes (including designerbrent's and my own first patch), so one can just download the 5.x-1.x-dev release, apply the patch and get it working. Patchak, I'm really new to Drupal, so I don't even know if I did the correct changes to the code :) . But I will help as I can. There is something you need in it, specifically?

caugmar’s picture

FileSize
25.8 KB

Ooops... My last patch was incomplete. I'm posting the correct one now. Could someone test, please?

vrabaud’s picture

FileSize
26.5 KB

Hi, that totally works for me ! Thx
I have a few suggestions though:
- there seems to be a bug (just a warning) when using a reference in conditional_fields_set_required_for_render. You want to modify line 914 as follows:
conditional_fields_set_required_for_render($item);
And line 882 as follows:
function conditional_fields_set_required_for_render(&$item) {
- using the 'slow' option in hide/show in the javascript is a nice addition I think: toSwitch.show('slow'); and toSwitch.hide('slow');

My patch includes those two changes and has to be applied on version 5.x.

Thx again designerbrent and caugmar for your amazing work !

Regards,
Vincent

caugmar’s picture

Hi Vincent,

Tested your patch, works great here. And the 'slow' option really was a nice touch. Thanks!

patchak’s picture

thanks for the patch! That's awesome news! I will test just a little bit more in the next days, but def. +1 from here for the patch! Caugmar, for the special features I need, I can't really think of something specific here, except that it should eventually work with taxonomy and hierarchical select!! ;)

If you want to have a look, be my guest!! ;)

Patchak

peterpoe’s picture

Done a little bit of testing and so far it seems to work. Very nice!

A couple of problems:
- The new cck configuration screen (admin/content/node-type/...) is not "conditional fields ready". This is bad because it won't enforce limitations on cond. fields and groups nesting.
- Didn't quite understand the use of "my_form_clean_id" and of the new conditional-field.tpl.php file created by the patch

Once these are solved, we can roll out a dev version so more people can test.

Thank you all!

neurer’s picture

Patches at #13 and #14 work for me too. Excellent work! Also had to apply patch at http://drupal.org/node/292014#comment-953194 to get rid of the conditional_fields_set_required_for_render() error.

Keep getting Invalid argument supplied for foreach() in /.../conditional_fields.module on line 440. though, but this doesn't seem to interfere with actual functionality.

peterpoe’s picture

I created a new dev branch for drupal 6, which should be available for testing in a few hours. I cleaned a lot of code and stuff. Please test test test!

Roulion’s picture

i set it up.
just a few questions?
can we have a chain of conditions like
if field 1 = a => field 2 = [b || c]
if field 2 = b => field 3 = [d || c]
such as hierarchical select?

peterpoe’s picture

#20: Nested conditional fields are not supported, sorry.

peterpoe’s picture

New update with a treat: animation options! Check cvs!
Attached patch is against latest 5.x-1.x-dev.

Roulion’s picture

ok no problem, that's not very critical for me.
Can it be plan to be in the future? May i open a feature request about that

peterpoe’s picture

Another patch: reworked allowed fields and the validation functions of field and group edit forms (was all messed up).

cYu’s picture

Installing the D6 version on a fresh Drupal install, conditional fields will not work until after you save the conditional fields settings for your content type. For instance, if you are using conditional fields for "Page" you will need to go to admin/content/node-type/page/conditional and save that settings page before controlled fields will show any behavior. I'm guessing it might be because a variable_get() somewhere does not have a valid default value as the second parameter.

Also the foreach loop at line 466...

foreach ($form_state['values']['conditional_fields'] as $controlling_field => $trigger_values) {

should be surrounded by

if (is_array($form_state['values']['conditional_fields'])) {

to avoid throwing warnings when no conditional fields exist on a content type.

Glad to see this making good progress in 6. Thanks for the work.

cYu’s picture

I see you've tried to address the required field issue in D5 #292044: Required fields within conditional groups not indicated as required with your D6 code.

The problem with it now, though, is that a required field will fail validation even if it is not triggered to be shown. If a controlled field is not triggered then no validation should be run on it, including the required check.

peterpoe’s picture

Committed to dev a big patch with a lot of fixes, reorganizing, cleaning, etc. Check it out!

@cYu #26: issue #292044: Required fields within conditional groups not indicated as required should be fixed in 6.x. Will backport to 5.x soon.

bsod’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Component: Code » Javascript
Category: feature » bug

Hide feature and animations doesn't work. I thought that maybe this is conflict with other module that uses js, but I've just set up clean drupal install with only cck and conditional fields and still nothing. Disable untriggered field works fine though. I also discovered that if I replace conditional_field.js with version from 5.x-1.x-dev package then hide untriggered fields works but without animations, so I guess it's .js issue.

peterpoe’s picture

Javascript was broken due to a wrong variable type. It is fixed in cvs now. You can also apply this patch to the old version.

bsod’s picture

Patch works great. Thanks peterpoe!

bsod’s picture

Component: Javascript » Code

Me again. I'm not sure if it's a bug or maybe a limitation, but when I put controlling field(select type) in a fieldgroup I can only link controlled fields triggered by the same value. If I add to this group fields that are triggered by different values then no data from the fields in the fieldgroup is saved and visible on node view. To make it more clear this is how it looks:

Fieldgroup
--controlling field(allowed values: v1, v2, v3)
--controlled field1(triggered by v1)
--controlled field2(triggered by v2)

peterpoe’s picture

I found that multiple fields using ahah were completely broken. I fixed a lot of stuff and committed to dev.
@bsod: the issue with fieldgroups is solved as well now.

daneyuleb’s picture

Is this working for everyone? The current 6 dev version did -not- work for me. (I'm using Content Profile to put node info on User Profile, so perhaps that's an issue).
Everything worked fine in the Form creation to create/hide conditional fields, but no matter what value the control field's checkbox was on, the conditional field was always hidden in the node. The fix is too small for me to bother creating a patch (just moved 1 line), especially if this isn't affecting anyone else.

Line 193 of conditional_fields.module:

$current_values[$field['control_field_name']] = $value['value'];
if (!empty($value['value'])) {
$viewed = TRUE;
}

--- changed to ----

if (!empty($value['value'])) {
$current_values[$field['control_field_name']] = $value['value'];
$viewed = TRUE;
}

($value was returning null entries along with valid ones, and the existing structure caused the "is_triggered" check to fail...)

kansaj’s picture

Hi
I have just tired the module on Drupal 6.8, but on every page (page in general) I receive the following message
"Conditional Fields settings have been updated." (the message appear to all users no matter of their access rights.
I cannot figure out what is the problem?

peterpoe’s picture

Rosamunda’s picture

I´m trying the dev version and still won´t work with fields inside groups.

peterpoe’s picture

@Rosamunda: are you referring to a previously reported bug? Or to a new one (if so, please report)? Thanks.

Rosamunda’s picture

Do you refer to #17?

Sorry I think it´s the same bug then.

kenorb’s picture

I can confirm #36 issue, all fields are visible (tested with grouped fields), whatever I'll select from dropdown. No errors on javascript console.
I can't test it without groups, because I've got error: 'You can't change the parent group of a conditional field'.

Rosamunda’s picture

I´ve received the same message: "You can't change the parent group of a conditional field", but solved it (receiving the message), adding the condition after the fields has been moved to a group.
But after adding it, it just won´t work.

peterpoe’s picture

@rosamunda & kenorb: Your problem might be caused by this bug: #363375: Conditional field settings get saved incorrectly, which corrupted cf settings. It was fixed on Jan 23 but only for new settings. Try to uninstall conditional fields and reinstall the latest dev. You will lose all cf settings, but the problem should disappear. Sorry for this.

Rosamunda’s picture

Trying this rigth now!
THANKS!!!

kenorb’s picture

matteogeco’s picture

Subscribe.

peterpoe’s picture

Status: Needs work » Fixed

Marking as fixed, as 6.x-1.x-dev is way more stable and has more features than old version 5. Thanks to everybody that contributed!

By the way, any help with backporting bugfixes from 6 to 5 is very welcome. Sadly, I have little time to devote to the development of this module, so backporting is last in the line.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.