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

Add Fill Color to Field

Explorer ,
Jul 08, 2017 Jul 08, 2017

Hi,

How can I make the fill color of the following field blue?  I tried "fillcolor: color.blue" but it did not work.

                                 

                                          {

                                                    type: "static_text",

                                                    item_id: "sta8",

                                                    name: "Filename Preview:",

                                                    font: "palette",

                                                    fillcolor: color.blue

                                                },

                                                {

                                                    type: "edit_text",

                                                    item_id: "Exmp",

                                                    width: 300,

                                                    height: 65,

                                                    char_width: 8,

                                                    multiline: "true",

                                                    readonly: "true",

                                                },

TOPICS
Acrobat SDK and JavaScript , Windows
845
Translate
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

correct answers 1 Correct answer

Community Expert , Jul 09, 2017 Jul 09, 2017

1) setForeColorRed() takes a string as a parameter, not an object and will only work when it is added to the initialize function of the dialog . The string is the item id of the element you want to be red. Please see my example higher up in the thread. If you don't have an initialize function, you need to create one.

2) It would be helpful if you posted the code for the entire dialog. With dialogs, it too hard to diagnose problems from snippets.

Translate
Community Expert ,
Jul 08, 2017 Jul 08, 2017

You're lucky you wanted red. Red is the only color you can use other than black. In your initialize function add the following line. Adjust the item_id to meet your needs.

dialog.setForeColorRed("sta8");

Translate
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
Explorer ,
Jul 08, 2017 Jul 08, 2017

Hi,

I can't get it to work still.  The Item ID is "Exmp."

function DoSetDocNumberFn(dialog, oDlg)

    {

               var oRslt = dialog.store();

               var strExample = oRslt["LPfx"];

              

               dialog.setForeColorRed("Exmp");

               dialog.load({"Exmp":strExample});

               DoSetFileName(dialog,oDlg);

    }

It still shows up as black text.

Translate
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 ,
Jul 08, 2017 Jul 08, 2017

You have the line right but as I stated in my answer, the code must be added to the initialize function of the dialog.

Like this...

         initialize: function (dialog)

         {

             dialog.setForeColorRed("Exmp");

         },

There might be other code in initialize as well. My example is just the simplest case.

Translate
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
Explorer ,
Jul 09, 2017 Jul 09, 2017

Hi,

Does anyone know why this is still not working?  I tried the following, which is differnet from yesterday.  It loads but there is no change in color.

dialog.setForeColorRed({"Exmp":strExample});

dialog.load({"Exmp":strExample});

Sue

Translate
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 ,
Jul 09, 2017 Jul 09, 2017

1) setForeColorRed() takes a string as a parameter, not an object and will only work when it is added to the initialize function of the dialog . The string is the item id of the element you want to be red. Please see my example higher up in the thread. If you don't have an initialize function, you need to create one.

2) It would be helpful if you posted the code for the entire dialog. With dialogs, it too hard to diagnose problems from snippets.

Translate
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
Explorer ,
Jul 09, 2017 Jul 09, 2017
LATEST

Oh, I see.  Thx for your help.  Next time I will post the entire dialog.

Translate
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 ,
Jul 08, 2017 Jul 08, 2017

Den er Grei

Translate
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