Thursday, March 7, 2013

Spring Roo :: Adjust text box size/width

Spring Roo uses Dojo's dijit.form.ValidationTextbox widget by default. This means only way to adjust textbox size is to adjust the width of widget. And this has to be done with widget attributes using Spring.addDecoration(); available in spring-js.

        Spring.addDecoration(new Spring.ElementDecoration({
            elementId : '_${sec_field}_id',
            widgetType : 'dijit.form.ValidationTextBox',
            widgetAttrs : {
                  promptMessage: '${sec_field_validation}',
                  invalidMessage: '${sec_field_invalid}',
                  required : ${required},
                  style: 'width: ${width}',
                  ${sec_validation_regex} missingMessage : '${sec_field_required}'
        }}));

Here I have used a new attribute width, which is added to input.tagx.

Usage:


Spring Roo input.tagx with adjustable width attribute

You may use the above gist as is or with modification

Related Posts Plugin for WordPress, Blogger...