I have seen posts about nested fieldgroups but nothing about fieldgroups in general.

I cannot get this to work if the conditional fields are in a fieldgroup. They work fine outside of it. Is this a known issue? I am using the CCK 3.x dev version so that may be a part of it.

Anyone?

Comments

Bilmar’s picture

subscribing

rconstantine’s picture

if the controller and field are in the same group, it works. i think that's in the documentation. what you are after is "cross-group" controllers/fields.

jeff.k’s picture

I just did a fresh install and its still not working. All fields show and there is no contitional behaviour.

If this is supposed to be working, the only think I can think it might be is I am using "6.x-3.x-dev (2009-Dec-06)" of cck.

jeff.k’s picture

i just tested "6.x-2.6" of cck and it is also not behaving in a field group.

JThan’s picture

Hello.

I can confirm. Inside a fieldgroup this is not working.

Not working (Fields in a Group):
Group
- Field A (controls Field B)
- Field B (is controlled by A)

Working (Fields not in a Group):
Field A (controls Field B)
Field B (is controlled by A)

I am using 6.x-2.6 of this Module on drupal 6.14

so what rconstantin is saying is not right. It does not work inside a group for me.

JThan’s picture

Title: Condional Fields in fieldgroup » Conditional Fields inside fieldgroup do not work

The fields inside a group are not wrapped with the conditional field divs. I do not know the reason. Just thought that info could maybe help with seeking the problem.

My try of starting to explore this, you do not need to read this.
Inside a group the controlled field is not wrapped by <div id="conditional-field-example" class="conditional-field controlled-field" style="display: none;"> and the controlling field not by <div id="conditional-field-relatedlinks" class="conditional-field controlling-field conditional-field-processed">.
Fields are not wrapped - Look in conditional_fields.module for function to wrap.
Find:

/**
 * Themes the wrappers around conditional fields.
 * Note that if you modify the id and classes of these fields,
 * you have to modify conditional_fields.js accordingly.
 */
function theme_conditional_fields_form_item($item) {

which is called by

/**
 * Main tasks:
 * - Create javascript settings
 * - Prepare custom validation for required controlled fields
 * - Assign a theme function to conditional fields
 * - Apply orphaned fields settings if applicable
 */
function conditional_fields_node_after_build($form, &$form_state) {

Here the fields are fetched from database - checked entry in Database. Both entries are there and good.
And here it stopps for now.

samkat12’s picture

Title: Conditional Fields inside fieldgroup do not work » Controlling field out side controlled field in a group causes fields to be required
Priority: Critical » Normal

removed to another issue http://drupal.org/node/453204
Conditional field is causing fields to be required even if they were not set up to be required. the situation is that when you place the controlling filed out side group and the cotrolled field in a group, the system does not allow you to save, it produces an error message that fields in group are required. even if the fields have been filled in. How ever there is no error if the controlled field is not triggered.
[...A..] controlling field out side Group
[...B...] Controlled field in a group. (produces an error message that the fields in the group are required to be filled in even if i have put data into them). Can any one help?

JThan’s picture

Priority: Normal » Critical

@samkat12: Please open a new report for that after you serached the issue queue and did not find an appropiate issue (Maybe here: http://drupal.org/node/453204). We still have our first problem in here not solved and I do not see how your problem is related to ours.

@maintainer , all: Setting this to critical, because this is a key feature of this module not working. Please change if you think it is not critical but to me the module is not working as intended.

JThan

samkat12’s picture

OK. I will Move it to the appropriate issue thread. thanks. probably to http://drupal.org/node/453204

peterpoe’s picture

Title: Controlling field out side controlled field in a group causes fields to be required » Conditional Fields inside fieldgroup do not work
Priority: Normal » Critical
Status: Active » Fixed

Just committed a fix to 2.x-dev.

JThan’s picture

Works for me.

Thank you.

samkat12’s picture

yes new dev version works.Thanks.

Netbuddy’s picture

Using the latest CCK 6.x.3 dev (had the latest 6.x-2 - same story) and the latest Conditional Field and im getting "You can't change the parent group of a conditional field."

I have a form with:

Job Details
+ Occupation - Triggering field
+ Occupation - Other - Triggered field when the user selects "other" from the occupation select dropdown
+ Pay Rate
+ Job Description
+ Job Location
+ Hours - Triggering field
+ Hours - Other - Triggered field when the user selects "other" from the hours select dropdown

So i have a pair of conditional fields with this fieldgroup, and I cant save either to appear within it.

peterpoe’s picture

#13 This is by design, since not all combinations of conditional fields and groups are possible (that is: fields inside controlled groups can only control or be controlled by fields in the same group). You can move the field first by making it not controlling and not controlled by anything, then changing group, and lastly making it conditional again.
We could make the message more informative, and the error appear only when the move would actually cause problems. I'm filing a new bug about this.

Netbuddy’s picture

Your workaround works a treat. Thank you :)

Status: Fixed » Closed (fixed)

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

danny_joris’s picture

#14 Thanks. Nice workaround, indeed!

johnhanley’s picture

I just experienced this issue today and peterpoe's instructional workaround works as described. Thanks for that.

I understand the technical reason behind it, but this behavior is rather clunky. A permanent solution should really be devised. In the meantime better messaging would help.

In any event, thanks for the useful module.