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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

haggan’s picture

Some news about this?
Any one found a solution for this?

Jibus’s picture

I am also looking for this feature

zebradog’s picture

I'd also be curious to hear more about this as I'm running into the same problem

Mark Trapp’s picture

mizage@gmail.com’s picture

I'm all for this! :)

linus79’s picture

Any news?

TelFiRE’s picture

Possible duplicate?
http://drupal.org/node/1161314

Jibus’s picture

Status: Active » Closed (duplicate)

Yes ! Duplicate of Fieldgroup support

vpsaravanan’s picture

Issue summary: View changes
FileSize
220.84 KB

Conditional 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();
}
}
});

vpsaravanan’s picture

vpsaravanan’s picture