Skip to main content
rakeshk21205956
Inspiring
December 23, 2016
Question

Formatting Text generated via action button

  • December 23, 2016
  • 1 reply
  • 636 views

I am trying to format a paragraph generated by an action button in a Text Field..

the javascript is as follows:

this.getField ("Text1").value = "Chief Complaint\n" + salutation + patient + " is inquiring about utilizing orthotic bracing for " + pronoun + " current conditions; " + pronoun + " chief complaint at the time of this assessment is: " + location + " pain.\n" + "\n" + "Medical History\n" + "Medical History findings taken during the intake portion of this assessment include: " + this.getField("hpi").value + "\n" + "\n" + "Subjective Notes – Information Reported by Patient" + "\n"+ "On a 1-10 pain scale " + salutation + patient + " describes " + pronoun + " pain as being at a level " + this.getField("dme.pain-level").value + ". " + salutation + patient + " " + location + " pain has been constant for " + this.getField("dme.length-of-pain").value + " months.\n" + salutation + patient + " chief complaint is " + location + " pain, which is associated with a level " + this.getField("dme.pain-scale").value + " pain on a severity scale of 1 to 10. The patient also says that " + this.getField("dme.worsens-pain").value + " aggravates the condition, temporarily resulting in higher pain levels on the severity scale. " + salutation + patient + " has indicated that " + pronoun + location + " pain makes it difficult to \n" + "\n"

I want the above Paragraph to be formatted with different color text, bold, underline, bullets etc...(as applicable)  like below when i click the action button.:

Chief Complaint

Mr. ......is inquiring about utilizing orthotic bracing for his current conditions; his  chief complaint at the time of this assessment is: Shoulder pain.

Medical History

Medical History findings taken during the intake portion of this assessment include:

Subjective Notes – Information Reported by Patient

On a 1-10 pain scale Mr. describes his  pain as being at a level mild. Mr.  Shoulder pain has been constant for 8 months.

Mr. ...........chief complaint is Shoulder pain, which is associated with a level  pain on a severity scale of 1 to 10. The patient also says that motion of any kind aggravates the condition, temporarily resulting in higher pain levels on the severity scale. Mr.  has indicated that his Shoulder pain makes it difficult to ...

IS IT POSSIBLE?

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 23, 2016

Yes, it is possible. You need to read about the richText property of the Field object and the Span object to be able to achieve it.

rakeshk21205956
Inspiring
December 24, 2016

i read and tried to do that.. but it was not working

for ex- if i want to output text when action button is clicked  "He is a good boy" in big fonts and different color.

Javascript which i made was :

var f = "He is a good boy";

f.textColor = color.blue;

f.textSize = 18;

but it didnot worked

Joel Geraci
Community Expert
Community Expert
December 24, 2016

Even if you only have one span, the rich value needs to be an array.

Your code might look something like this...

var spans = new Array();

spans[0] = new Object();

spans[0].text = "He is a good boy";

spans[0].textColor = color.blue;

spans[0].textSize = 18;

this.getField("myFieldName").richValue = spans;

Take a look at the example in the documentation at the link below

Field properties