Use instanceof instead of checking .type when checking for Textbox. Improved display of controls when Textbox is in a group.