Posted by emorency on May 18, 2011 at 1:47pm
105 followers
Jump to:
| Project: | Conditional Fields |
| Version: | 7.x-3.x-dev |
| Component: | Compatibility w/ other modules |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I would like to be able to show/hide a group of fields (according to the documentation it's supposed to work).
I've created a fieldset with all fields that will be dependent but this group field is not in the list of dependent. How can a dependee affect a group of dependent fields ?
Thanks!
Comments
#1
This functionality is still missing from Conditional Fields 7.x-3.x. Please follow this issue for announcements when it will be implemented.
#3
subscribe
#4
subscribe
#5
Subbing
#6
Subbing too.
#7
+1
#8
subscribe
#9
subscribe
#10
I don't think you meant to assign it to you - unless you intend to fix this yourself?
#11
No, you are right, but can't change it back.
#12
That's because I fixed it for you :)
#13
subscribe
#14
I was taking a shot at implementing this and found that under current implementation this seems almost impossible. The conditional_fields table saves only the field id, which is a number. Based on this number there is no way of knowing whether it is a regular field or a group field.
What I think is that in order to implement this the conditional_fields table should change to store the field name instead. Or add another column that specifies if this is a field or a group field.
What do you think?
Also, this only would apply to the dependent field, as no dependee can be a field group.
#15
sub!!!
#16
Subscribing;
#17
+1 subscribing
#18
subscribing
#19
subscribe
#20
subscribe
#21
+1
this would be very useful.
#22
Field group support is not a small task, it will probably take some time. In the meantime, consider using the Field collection module, which already works (almost) perfectly with Conditional fields.
#14: You're right, it would be necessary to change the schema by adding a 'dependent_type' or 'dependent_module' column that identifies the type of dependent (field or fieldgroup).
#23
Wow! I didn't know about field_collection. But looks pretty nice. Hope to try it soon.
#24
subscribe.
Field collection it's a good tool, but why should we build new entities when just some grouped fields are needed.
I think this is a very needed feature and more than nice to have.
#25
+1
#26
sub
#27
sub
#28
+1 For this.
#29
@davidlerin there is now a follow button at the top you know =)
#30
This feature would be great!
I have a huge form with 100+ fields that are dependent on each other and I would really like to display them using tabs split into their categories etc rather than on one massive long page as not all fields are needed depending on the initial selection.
#31
I found that Conditional Fields module does actually work with Fieldgroup module. I use vertical tabs for sorting all my fields. Unless both dependent and dependee are in the same tab, dependencies work.
#32
@Rontero - what do you mean 'it works'? Im using Accordion groups to group fields, and these accordion groups not available for selection by conditional fields. Accordian are much the same as vertical tabs in terms of the implementation - it's just a different widget on the fieldgroup. How exactly re you using vertical tabs with conditional fields?
#33
@mrfelton I'm using conditions on fields not on accordions etc. As long as yoour dependent and dependee are in the same group, Conditional Fields module works.
Example from my site:
I have Drupla Commerce installed for adding products to my site.
Case: Select the appropriate country (the manufacturer is based in) after user selects maker's name.
First field is dependee and second is dependent.
After constructing such a form, in manage dependencies tab i made proper dependent/dependee selections and as a rule used fields with a value / has value.
I hope this helps.
#34
@Rontero;
True, even if the two fields are not in the same field group the dependencies work. For example, one client's site has registrants choose individual or group registration type. If they choose individual several conditional fields will be shown and vice versa if you choose group.
But what he wants and what I'm trying to get working again is that the entire field group will be shown or hidden pending the choice. Otherwise even if I set each field to show or hide pending the choice, the field group still shows - with the label for it - just none of the individual fields do.
#35
I'm looking for the same solution as Fanaile
#36
@Fanaile: This is exactly what I am in need of, too. Please let us know in case you solve this in any way.
#37
Yes, getting the
would be a great feature that's needed.
#38
In D7: It would be better to use a parent/child situation. A new field that is the field id of the field_group table as the parent_id. start gathering the children and see if they all have the same parent. if so then show the parent.
#39
Very interested too, has there been any movement on this or will there even be any attempt to implement the feature?
#40
Oh, no activity here ;(
#41
sub
#42
Any way to display or not an entire group using CF?
#43
+1 subscribing
#44
For now you can kinda do this with javascript. We haven't tested this too much, but have it running on one of our sites.
First, make a javascript/jquery function to hide empty fieldsets
Drupal.mymodule.cleanupFieldsets = function() {
$("fieldset").each(function(){
var fieldset = $(this);
fieldset.show();
var wrapper = fieldset.find(".fieldset-wrapper");
if(wrapper.height() == 0){
fieldset.hide();
}
else{
fieldset.show();
}
});
}
Then, bind a change event to every form widget in your node form to fire the cleanup function
$('input, select').change(function(){Drupal.mymodule.cleanupFieldsets();
});
#45
+1