Formatting text fields

Are there any plans to add formatting options to text fields on forms? I’ve been reading the dev manual and on pages 60-62 a variety of formatting options are given for number and datetime fields, but text fields are not mentioned. Could text formatting features be added? Thanks.

Hi there,

What sort of formatting are you trying to perform? There are many ways to format text via methods. For example, if you want to change the color of the text in a dataprovider:

elements.firstNameText.fgcolor = ‘#3300cc’;

What you need to do is fill in the name property for the dataprovider, which will then make it available in the elements list. In this case, I made my firstName field and element called firstNameText. Once you make it an element, you have a host of options such as setFont and setSize.

Another option is to create a method with HTML tags:

namefirst = “” + namefirst + “”;

Here, my dataprovider, namefirst, is set to bold. To make this work, you need to set your dataprovider display type to HTML_AREA. Then, I trigger the method onFocusLost. Once I leave the field, the data becomes bold face.

Hope this is helpful.
Adam

I’m talking about auto formatting stuff like social security numbers and having things like title case or always upper case or always lower case, but customizable. Sorry about not being more specific.

That’s cool. Sorry for my long post! I’m not sure about lower/upper case, etc., haven’t tried that yet. But, here’s a method you can attach to a social security field that will auto format the number. Attach it to the field in the onFocusLost property:

//checks to see if field socsecurity is already hyphenated, if it is it leaves it alone
if (utils.stringPatternCount(socsecurity, “-”))
{
socsecurity;
}
else
//if not, it inserts the hyphens
{
var ssecurity = utils.stringLeft(socsecurity, 3)+ “-”

  • utils.stringMiddle(socsecurity, 4, 2)
  • “-” + utils.stringRight(socsecurity, 4);
    socsecurity = ssecurity;
    }

You can do this for phone numbers too.