function checkCollapsedFields(selector)
{
	var fields = selector + ' input,' + selector + ' textarea,' + selector + ' select';
    console.log(fields);

	var nb_fields = $(fields).length;
    console.log(nb_fields);
	var nb_required = $(fields).filter('[required]').length;
	console.log(nb_required);
    var nb_filled = 0;
	var nb_necessary = 0; 
	
    $(fields).each(function(i, field){
        if ($(field).val() != '')
        {
            nb_filled++;
        }
    });
	
    $(fields).filter('[required]').each(function(i, required){
        if ($(required).val() != '')
        {
            nb_necessary++;
        }
    });

    var result = nb_filled + " / " + nb_fields;
    result = result + " | " + nb_necessary + " / " + nb_required;

    console.log(result);

    var check = $(selector).parent().find('.check');
    console.log(check);

    // $(selector).parent().find('.check').html(result);
    if (nb_necessary < nb_required) {
        $(selector).collapse('show');
    }
}
