3 Replies Latest reply on Feb 22, 2018 10:57 AM by Thom Parker

    Highlighting text within a text field that is determined by custom calculation script-Adobe Acrobat DC

    tessanm Level 1

      Hello,

       

      I do not have the JavaScript extension in my Adobe so I have been getting around that by using the 'Custom calculation script' calculation on text fields. I got stuck recently and could use some help.

       

      I wrote the script below for a document I am working on. I needed the selection from drop down menu ("A") to auto-populate text into text field ("Text1"). I used this calculation in the ("Text1") field. Each drop down selection has it's own body of text, the script works but I am stuck because now I want the script to highlight and italicize certain words/phrases in each of the auto-populated answers.

       

      var choice = this.getField("A").value;{

      if (choice=="COMPANY COVERED")event.value = ("Company is willing to cover $XXXXXX");

      else if (choice=="NO CONTRIBUTION")event.value = ("Company is willing to contribute $XXXXXX, to assist with this cost, leaving a balance of $XXXXXX. This balance will need to be paid directly to Company or an approved contractor.  You agree that you will be responsible for the Full Cost of $XXXXXX if we perform the work outlined in this notice and your agreement is canceled by you. Please note Company's offer to contribute financially to your contract cost, only applies to your currently executed system, pricing, and your XXXXXXX payment type.");

      else if (choice=="PARTIAL OUT OF POCKET")event.value =("Company will cover $XXXXXX, you will be responsible for covering $XXXXXX.");

      else if (choice=="NO ROLL IN AMOUNT")event.value =("You as the customer will be responsible for paying $XXXXXX which cannot be rolled in to your contract");

      else if (choice=="ROLL ALL IN")event.value =("Yes $XXXXXX");

      else event.value = " ";

      }

       

      I want to highlight everywhere the text shows "$XXXXXX" or "XXXXXXX" and I want to italicize where it says "Please note Company's offer to contribute financially to your contract cost, only applies to your currently executed system, pricing, and your XXXXXXX payment type"

       

       

      Your help is greatly appreciated.