View Full Version : Ext.form.Fieldset inconsistent setInstructions behavior

29 Jul 2011, 12:45 PM
It's possible to set fieldset instructions to '' prior to form rendering and hide the instructions element entirely. Setting instructions to '' after render causes those elements to be created and displayed (as empty grey divs by default.)

- make the empty string ('') behavior consistent pre- and post-render
- provide a mechanism - either a new method, or passing undefined, null, or false to setInstructions - clear the instructions text and remove its element entirely

1 Aug 2011, 9:08 AM
Ext.override(Ext.form.FieldSet, {
setInstructions: function(instructions, removeEmpty) {
removeEmpty = removeEmpty || false;

if (this.rendered) {
if (this.instructionsEl && instructions.length == 0 && removeEmpty) {
delete this.instructionsEl;
} else if (!this.instructionsEl) {
this.instructionsEl = this.el.createChild({
cls: this.componentCls + '-instructions'

if (this.instructionsEl) {
} else {
this.instructions = instructions;
return this;

This override adds a new parameter for you. Not everyone would want to remove it for whatever reason but if you set that second param to true it will remove the EL if the string is empty. If you want the default to be true then just change the line

removeEmpty = removeEmpty || false;


removeEmpty = removeEmpty || true;