7 Replies Latest reply on Dec 24, 2016 4:53 AM by rakeshk21205956

    Formatting Text generated via action button

    rakeshk21205956 Level 1

      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?

        • 1. Re: Formatting Text generated via action button
          try67 MVP & Adobe Community Professional

          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.

          • 2. Re: Formatting Text generated via action button
            rakeshk21205956 Level 1

            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

            • 3. Re: Formatting Text generated via action button
              Joel_Geraci Adobe Community Professional

              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

              • 4. Re: Formatting Text generated via action button
                rakeshk21205956 Level 1

                the above script doesnot work right for me.. it gives the output [object object]..

                 

                plz help where to put your script in the following javascript..to obtain the desired output text. Also in the text fied when i allow rich text formatting then "\n" doesnot work....

                 

                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"

                 

                  The above script should give the below result:

                 

                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 ...

                • 5. Re: Formatting Text generated via action button
                  rakeshk21205956 Level 1

                  I tried and tried and at last this javascript worked but i am not able to import the value of other fields in this.... like name from other text field... i am unable to import..... i can only format the absolute texts...... but when i insert any value of other field .. this script doesnot work....

                   

                  like in above paragraph ...

                   

                  After Mr...... the value will depend upon the other text field value which i have to import via this.getField("First Name") .value .. but when i insert this line.. the script doesnot work at all..

                  • 7. Re: Formatting Text generated via action button
                    rakeshk21205956 Level 1

                    I tried and tried and at last this javascript worked but i am not able to import the value of other fields in this.... like name from other text field... i am unable to import..... i can only format the absolute texts...... but when i insert any value of other field .. this script doesnot work....

                     

                    like in above paragraph ...

                     

                    After Mr...... the value will depend upon the other text field value which i have to import via this.getField("First Name") .value .. but when i insert this line.. the script doesnot work at all..