Download & Extend

Conditional Fields doesn't work with anonymous user

Project:Conditional Fields
Version:6.x-2.0
Component:Compatibility w/ other modules
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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.

Comments

#1

Subscribing

#2

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';
}

#3

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

#4

#5

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

#6

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

#7

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.

#8

Status:needs work» needs review
AttachmentSize
conditional_fields-content_profile_registration-959728-8.patch 518 bytes

#9

Component:Miscellaneous» Compatibility w/ other modules
Category:support request» bug report
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.

#10

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.

AttachmentSize
conditional_fields-content_profile_registration-959728-10.patch 539 bytes

#11

For me also works fine 6.2, thanks!

#12

Thanks! omitsis ,
It works well.

#13

Works well for me, too.

#14

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!

#15

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

#16

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

AttachmentSize
conditional_fields.txt 61.77 KB

#17

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.

#18

Title:do not work with anonymous user » Conditional Fields doesn't work with anonymous user

#19

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.

nobody click here