Skip to main content
Participant
July 16, 2018
Question

Format default text in text box

  • July 16, 2018
  • 2 replies
  • 1542 views

Is there a way apply different formatting to text as default text in a text box?

In the example shown, I would like to have the first word (shown in green in the example) bold - and the rest normal unbold.  
Unfortunately, applying formatting appears to apply to the entire contents of the "Default Value" - not just selected text.

If that isn't possible, can the text box have a title?

This topic has been closed for replies.

2 replies

TMWagnerAuthor
Participant
July 16, 2018

Thank you, I was afraid that that was the answer...

I should probably pose this as a separate question, but the solution applies to the same problem:

Is it possible to LINK to text boxes together in a group?  I am trying to hide/show text on a form based on the response to a checkbox (I can easily do this with javascript with ONE field - and yes, I know I could turn on two or more fields, it just gets really messy).

Or ---

How hard (if possible at all) would it be simply add(display) text based on a checkbox response (again using javascript)

try67
Community Expert
Community Expert
July 16, 2018

- You can access multiple fields at once if they are named in a specific way that makes them all a part of a group.

The way to do that is to use a period with the group's name before it and the field's individual name after it.

For example: MyField.Text1 and MyField.Text2

You can then hide both fields like this:

this.getField("MyField").display = display.hidden;

- Setting the value of a text field based on a check-box is a common thing. You can use a script under the text field's custom calculation script to achieve it. Here's a simple example:

if (this.getField("Checkbox1").value=="Off") event.value = "NO";

else event.value = "YES";

TMWagnerAuthor
Participant
July 17, 2018

Genius!  postfixing the fieldname  with ".name" made life much easier. try67

try67
Community Expert
Community Expert
July 16, 2018

I don't think that's possible, as the default value of a field is just a string of text, not an array of Span objects, which is what you would need to use to do it.

try67
Community Expert
Community Expert
July 16, 2018

One workaround I thought of is to use the field's On Blur event and apply that rich value, if the field is empty.

However, that won't work when the form is reset manually...

TMWagnerAuthor
Participant
July 16, 2018

That won't work in this case - the text field is read only. (I'm using it only to display a response to the checkbox)