• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Fillable Form Population - Conditional Formatting

Community Beginner ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

Hello, I recently created a fillable form that integrates with a Smartsheet product.  How do I apply conditional formatting to color code a text field auto populated from a different application (ie, "Red" = change fillColor to color.red, "Yellow"=change fillColor to color.yellow, etc.)

 

Any help you can provide is greatly appreciated.

 

Edwina -

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , How to , PDF forms

Views

623

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

As the field's custom calculation script you can add something like this:

if (event.value=="Red") event.target.fillColor = color.red;

if (event.value=="Yellow") event.target.fillColor = color.yellow;

etc.

If the data is imported from an external source you would need to add a command to execute all of these scripts when the file is opened, by adding this code as a doc-level script:

this.calculateNow();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

Hi, thank you for the feedback.  Yes, you are correct, data is imported from an external source.  Following are the changes I made to my original script: 

Edwina5FF7_0-1607383197922.pngEdwina5FF7_1-1607383312651.png

Unfortunately, the fill color did not change per my criteria.  Please advise.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

After importing the data you have to re-open the file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

There's another option I discovered recently, that doesn't require re-opening the file, or calling calculateNow.

Try placing the code as the custom Format script of the field, and see if that works any better...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

Hi, I linked my data fields to the fillable form, downloaded, and then re-open the PDF document -- the field color (Overall Project Status) did not change.  

Edwina5FF7_0-1607384747905.png

Will adding the calculation script to an 'Actions' function help?  Not sure if that is an alternative solution or not?

Thanks again for your help.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

No, that won't work. Can you share the file with us?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

LATEST

Hi, I experimented with a Custom Format/Keystroke Script but it simply changed the field's default color to yellow --- 

var v=this.getField("Project Status").valueAsString;
if(v=="Red")event.target.fillColor=color.red;
else event.target.fillColor=color.yellow;

 

Edwina5FF7_0-1607455216698.png

Unfortunately, I cannot forward an attachment in this forum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines