Problem with extra spaces and Text area field type!

Dear all,

Perhaps someone can help out. We have started to have an issue with all of our File Notes in Notes module and Tasks. Text area field type is having a problem since we upgraded to v 7.12.5. Characters <<>>, <>, () and even / in some rare occasions combined with any of those is creating extra spaces on every save if there are already line breaks in between texts.

We have 60000 thousand records and File Notes and once these spaces and text reaches limit of text area size, they start deleting the text from beginning of the file while you add some new at the bottom.

To test this, just add new Task in v 7.12.5 and add <<>> or <> or () characters while you are having 2 lines of text separated with a line break and you will see the results.

Best Regards,


Do you see the same issue on ?

Haven’t tested it there, but new 7.21.7 and 8.2.0 have that issue and several prior versions. We have upgraded to 7.12.5 from 7.11.18 which did not had that problem.

Major issue is <<>> or <> characters, () or / is occasional with certain files.

Not sure, what we should do.

Best Regards,


Hi @slavenglaafs
Firstly you can create a before_save_hook
And you can use this code

class trim_before_save_class{

    function trim_before_save_method($bean, $event, $argument){

        $bean->name                           = trim($bean->name);
        $bean->signer_email                   = trim($bean->signer_email);
        $bean->app_url                       = trim($bean->app_url);
        $bean->client_id                   = trim($bean->client_id);
        $bean->client_secret               = trim($bean->client_secret);
        $bean->account_id                   = trim($bean->account_id);
        $bean->base_url                       = trim($bean->base_url);
        $bean->api_version                   = trim($bean->api_version);
        $bean->authorization_server           = trim($bean->authorization_server);

maybe it help you.

@vijay1992 Thanks for suggestion. I have tried to place the code under logic_hooks.php of Notes and Tasks where we have some Text Area fields but it does not work.

Added note and description Text Area fields to your code but nothing has happened.

To be more precise, I have created 2 files, one logic_hooks.php with:

// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array[‘before_save’] = Array();
$hook_array[‘before_save’][] = Array(1, ‘trim_before_save_class’ , ‘custom/modules/Notes/trimDescField.php’ , ‘trim_before_save_class’ , ‘trim_before_save_method’);

and another where the field name is stored with your code, trimDescField.php:

class trim_before_save_class{
function trim_before_save_method($bean, $event, $argument){
$bean->description = trim($bean->description);

All of them are stored in custom/modules/Notes folder…

Just a quick update…another combination also creates line breaks in Text Area fields:

file (some text).

Key word is “file” then some text in brackets (some text) following by dot or .

Also, breaking up to a new line solely after a file keyword does not work, it will create line breaks again:


(some text).

These are variations that will work and stop line breaks from creating:

file “some text”.

file -some text-.

file (some text.


(some text).


…(some text).

For <> or <<>> there are no variations on how to make them work, if they exist line breaks will continue to create on every edit and save.

Hope this helps.

I can confirm that there is a problem on
Create a note with


in the text.

It is saved as AAA CCC

Could it be another problem with the update of the html cleaning function (that also is a major issue for email templates)?