SugarCRM 6.0 TextArea width via code injection

While SugarCRM provides developer tools, such as the Studio and Module Loader, to customise various aspects of SugarCRM, some simple things are not possible through the developer tools. In this case, the developer generally has to edit PHP files, possibly creating new field types to overcome the inadequacies of the built-in types.

One example of this is setting the width of a TextArea field type to be 100%. This is a common thing to do for multi-line text fields when the user does not want to be restricted to a fixed-width text entry field. As of SugarCRM 6.0, the size of the HTML textarea used to edit the field can be set on a field-by-field basis - however, the size can only be specified as fixed size.

Before resorting to implementing a new field type or modifying the existing one, I wondered if a sneaky, benevolent piece of code injection could do the trick... But first, let's look at an example of the problem at hand. Consider the Description field from the Project module. When you edit a project record, you are presented with a form like the following:

What I want is to make that textarea the full width of the form. Using the Studio developer tool, we can edit the properties of this field. This is where we inject the HTML code. Look at what I set the Columns attribute to be:

The result is shown in the following screen shot:

As you can see, the textarea now takes the full width of the form, which was the desired outcome.

I really did not expect this code injection to succeed and am a little shocked that form validation in SugarCRM didn't pick this up. Perhaps they will close this hole in future versions...