Expand my Community achievements bar.

SOLVED

Formatted default text in text field

Avatar

Level 3

I would like to have some default text in a text field and have it on 3 separate lines in the text field. Is this possible?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can create a multiline default text with a manipulation of the value in the XML source.

1. Select you text field and enter your default text in the object palette

2. Got to XML source and look for the line with your default text

            <value>

               <text>This is my default text</text>

            </value>

3. Enter this code &#xD; everywhere into the text, where a line break should appear.

            <value>

               <text>This &#xD;is &#xD;my &#xD;default &#xD;text</text>

            </value>

The text field now shows, even it is not set up to display multiple lines.

     This

     is

     my

     default

     text  

View solution in original post

3 Replies

Avatar

Level 7

On the initialization event (this example uses formCalc)

$="Line #1
Line #2
Line #3"

You can use the unicode representations for the newline character, however, I hate looking them up and have found that they are not needed since they appear to be inserted invisibly when you enter scripts by keying the "enter key"

You will need to set the field up to allow multiple lines in the object tab.

Good luck!

Avatar

Correct answer by
Level 10

Hi,

you can create a multiline default text with a manipulation of the value in the XML source.

1. Select you text field and enter your default text in the object palette

2. Got to XML source and look for the line with your default text

            <value>

               <text>This is my default text</text>

            </value>

3. Enter this code &#xD; everywhere into the text, where a line break should appear.

            <value>

               <text>This &#xD;is &#xD;my &#xD;default &#xD;text</text>

            </value>

The text field now shows, even it is not set up to display multiple lines.

     This

     is

     my

     default

     text  

Avatar

Level 2

Hi,

I know it's too late, but I can share something

In the default field in the property you can press combination keys after each line to create new line effect without going to the XML source.

These keys are: Ctrl+Enter

For example:

If you type in the Default field or in the Tool tip :


     This <hit Ctrl+Enter> is <hit Ctrl+Enter> a <hit Ctrl+Enter> test

You should get this effect in the field or in its tool tip popup:

  This

  is

  a

  test


I hope this will save some key strokes and lower code maintenance.

BR,

Yasser