It works fine with authenticated user, but when anonymous user filling the node, the conditional field always showing even the trigger taxonomy has not been selected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

elegantgowns’s picture

Subscribing

omitsis’s picture

Status: Active » Needs work

It seems that when you are not logged inn, the $form['#after_build'] is not executing properly.

If you want to workarround this, you can edit the file conditional_fields.module
and change the code:

function conditional_fields_node_editing_form(&$form, $form_state) {
$form['#after_build'][] = 'conditional_fields_node_after_build';
}

-------------------------------------------------
by
---------------------------------------------

function conditional_fields_node_editing_form(&$form, $form_state) {
//workarround by omitsis.com
global $user;
if(!$user->uid){
$form = conditional_fields_node_after_build($form, $form_state);
}
$form['#after_build'][] = 'conditional_fields_node_after_build';
}

LGLC’s picture

omitsis, you are a legend! That worked perfectly. I think it should be committed!

kenorb’s picture

andiart’s picture

#2 works for me. won't it be commited?

peterpoe’s picture

It works with regular core fields. What kind of fields are you using?

AaronBauman’s picture

i can verify this issue using:
- a controlling select / radios field
- a controlled fieldset
- content profile
- content profile registration

on the user registration form, the fieldset does not respect conditional settings.
in fact, content_profile_registration explicitly skips #after_build
it works fine on the content_profile edit form.

fago (content_profile maintainer) indicated a few times that this behavior is by design
#826126: Add in #after_build callbacks to $form

i can verify that the workaround in #2 fixes the issue.

AaronBauman’s picture

Status: Needs work » Needs review
FileSize
518 bytes
jptavan’s picture

Component: Miscellaneous » Compatibility w/ other modules
Category: support » bug
Status: Needs review » Reviewed & tested by the community

I have the same issue after upgrading from 6.x-1.1 to 6.x-2.0, with content profile registration.

* controlling : select list
* controlled group with several text field

This patch solve the problem for me.

maddentim’s picture

This patch worked for my issue. There was one small code standards issue with the patch from #8 (needed space between if and the ()

Here is a fresh patch.

matdab’s picture

For me also works fine 6.2, thanks!

yogwiz’s picture

Thanks! omitsis ,
It works well.

jerry’s picture

Works well for me, too.

Buckminster_Bond’s picture

I have the same issue on the D7 x 3 x Dev.

I've tried numerous ways of applying the patch - but unfortunately my PHP skills are not up to it.

Any help much appreciated!

penyaskito’s picture

Patch from http://drupal.org/node/959728#comment-4957982 fixed my issue. Please, commit it!

senzaesclusiva’s picture

FileSize
61.77 KB

Same problem ...can't be able to apply patch

Why in my conditional_filed.module there isn't this function?
"function conditional_fields_node_editing_form(&$form, $form_state)"

Both in 6.0.2 and 6.02-dev
Rename file in ".module" if needs

steven-spencer’s picture

Version: 6.x-2.x-dev » 6.x-2.0

The replacement function is #10 worked for me using D6, conditional fields 6.x-2.0, and content profile 6.x-1.0 w/ registration form for anonymous users.

kenorb’s picture

Title: do not work with anonymous user » Conditional Fields doesn't work with anonymous user
maddentim’s picture

Status: Reviewed & tested by the community » Active

Hi, I don't think my patch (http://drupal.org/node/959728#comment-4957982) is needed any longer. I had another problem and ended up trying the latest commits from the git repo that have not been released. I think they have fixed this issue with a different approach. My problem was related to my nodes being content profiles completed at registration. I believe this commit fixed my particular problem: http://drupal.org/commitlog/commit/4894/ab6a2be0356181a8d48003b9aa3d9881...
I'd close this, but my problem was more related to content_profile than just anonymous users. Perhaps others have different issue though. Since the patch cannot be applied to the current development branch, I am removing the RTBC designation.

peterpoe’s picture

Issue summary: View changes
Status: Active » Closed (outdated)