Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi -
The field group remains on the page when the fields within that group are hidden using Drupals form states or the "Conditional Fields" module, which is just a ui way on implementing form states.
I think we can accomplish this by writing some jQuery code to check if the fields are hidden, or visible. If all fields are hidden then we just can hide that field group. Although, I think we would have to react on when the dependent field has been changed, so we can make the field group visible so the field dependencies are then shown correctly.
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#11 | add_this_class_to_first_grouping.png | 184.66 KB | vpsaravanan |
Comments
Comment #1
haggan CreditAttribution: haggan commentedSome news about this?
Any one found a solution for this?
Comment #2
Jibus CreditAttribution: Jibus commentedI am also looking for this feature
Comment #3
zebradog CreditAttribution: zebradog commentedI'd also be curious to hear more about this as I'm running into the same problem
Comment #4
Mark TrappComment #5
mizage@gmail.com CreditAttribution: mizage@gmail.com commentedI'm all for this! :)
Comment #6
linus79 CreditAttribution: linus79 commentedAny news?
Comment #7
TelFiRE CreditAttribution: TelFiRE commentedPossible duplicate?
http://drupal.org/node/1161314
Comment #8
Jibus CreditAttribution: Jibus commentedYes ! Duplicate of Fieldgroup support
Comment #9
vpsaravanan CreditAttribution: vpsaravanan commentedConditional field module is working fine to toggle form fields by states property. But when we add group to grouping fields, states property is working fine for fieldset alone. It is not supporting other groupings (div) to group fields. If we add any background-color to groupings (div), it is displaying div with bg color (bg-applied-div.png). To toggle such divs, i used below code as a temporary solution.
Add class as header-div in the first(parent) group (add_this_class_to_first_grouping.png).
$(document).bind('state:visible', function(e) {
if(e.trigger) {
var selected_outlet_type_div;
var outlet_parent_div;
var outlet_before_selected_parent_div;
$.each(e, function(key,val) {
if(key == 'value') {
if(val == true) {
var id = $(e.target).first().attr('id');
selected_outlet_type_div = id;
outlet_parent_div = $('#'+selected_outlet_type_div).parents('div.header-div').eq(0).attr('id');
return false;
} else if (val == false) {
var before_parent_div_id = $(e.target).first().attr('id');
outlet_before_selected_parent_div = $('#'+before_parent_div_id).parents('div.header-div').eq(0).attr('id');
}
}
});
if(outlet_parent_div != undefined) {
$('#'+outlet_parent_div +'.field-group-div').css('display', 'block');
//if($('#'+outlet_parent_div).find('>.field-group-div').is(':visible')) {
$('#'+outlet_parent_div).find('.field-group-div').show();
//}
} else if(outlet_before_selected_parent_div != undefined) {
$('#'+outlet_before_selected_parent_div).find('.field-group-div').hide();
}
}
});
Comment #10
vpsaravanan CreditAttribution: vpsaravanan commentedComment #11
vpsaravanan CreditAttribution: vpsaravanan commented