Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Looking for a default text script?

Avatar

Level 3

I'm working on recreating a form and the text box is fairly large with some instructions on what to put in that space set as default.  I'm not sure how to get multiple lines in as the default.  Is there some script to add more lines??  Any help on this is grealty appreciated...thanks so much.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If the instructions are fixed and will not change at runtime, why not use a Text object, instead of the TextField object? This way you can just type in the instructions directly into LC Designer.

If you are going with a TextField object, then the default (Object > Value palette) can accept line returns, just hold Control and hit Return and this will give you a new line. However type this is a single line view will be painful. You could type it in Word and then paste it into the Default. It should honour the carriage returns.

Again, if running with the TextField object, you can use a script in the docReady event:

this.rawValue = "This is a very long set of instructions.\n\nPlease read carefully."; 

Note that \n will give you a new line.

Havving said all that I would use the Text object for static text.

Good luck,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

If the instructions are fixed and will not change at runtime, why not use a Text object, instead of the TextField object? This way you can just type in the instructions directly into LC Designer.

If you are going with a TextField object, then the default (Object > Value palette) can accept line returns, just hold Control and hit Return and this will give you a new line. However type this is a single line view will be painful. You could type it in Word and then paste it into the Default. It should honour the carriage returns.

Again, if running with the TextField object, you can use a script in the docReady event:

this.rawValue = "This is a very long set of instructions.\n\nPlease read carefully."; 

Note that \n will give you a new line.

Havving said all that I would use the Text object for static text.

Good luck,

Niall

Avatar

Level 3

This worked perfect!!!  Thank you!! You saved me!!