hide empty groups in beautiful forms

this code was added during debugging for another fix
which ended up making its way into the commit (4b1478e2)

fixes: http://manage.dimagi.com/default.asp?119523