Formatting text

Last modified


This section describes how to reformat text fields, using an example of forcing upper case text.

Formatting text

Upper Case

Generally, text fields are formatted properly but, if you need to make a text field always in caps, from the Properties dialog, select Format > Custom > Edit and insert the javascript code shown below:


Title Case

To force 'Title Case', use the following script in place of the above example:

function toTitleCase(str) {
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
event.value = toTitleCase(event.value);

Removing Spaces

To strip spaces from a text field, use the following script:

event.value = event.value.replace(/[\" "\r]/gm, "") ;

This is useful where the data field has spaces, but the result has to be formatted across a number of boxes for individual characters with the span function.

Page statistics
354 view(s) and 7 edit(s)
Social share
Share this page?


CCH Insolvency




 | Cookie Policy | Copyright | Privacy Policy Terms of Use | Contact Us |