Skip to main content
Inspiring
June 25, 2021
Answered

changing colors of a textfield through clicking a button

  • June 25, 2021
  • 2 replies
  • 2236 views

I want to change the value, the  color and the fillcolor  of a textfield after clicking a button.

Changing value works fine, but changing colors not. I tried several forms, must be a general problem, that i do not see..


var summe = 0;

var feld1 = this.getField("firstvalue");
var feld2 = this.getField("secondvalue");
var ergebnis = this.getField("sumofvalues")

summe = feld1.value + feld2.value;
ergebnis.value = summe ;
ergebnis.textcolor =color.red;
ergebnis.fillcolor =color.blue;

any help appreciated

    This topic has been closed for replies.
    Correct answer Benedikt5FA4

    Disable the field highlighting.


    I tried this:

    app.runtimeHighlight = false;

    it works!

    thank you all so much for your help

    -ben from the now warm Eifelmountains in Germany

    2 replies

    try67
    Community Expert
    Community Expert
    June 25, 2021

    Replace textcolor with textColor and fillcolor with fillColor...

    Inspiring
    June 25, 2021

    great!  textColor now works fine! But the background of field remains white, when I set fillColor = color.blue.

    Any idea?

    Nesa Nurani
    Community Expert
    Community Expert
    June 25, 2021

    Where do you use script?

    LinSims
    Community Expert
    Community Expert
    June 25, 2021

    Please let us know which program you are having problems with. Someone will be along to move this post to the appropriate product forum, where you are more likely to get an answer to your question.

    The Using the Community forum is for help in using the Adobe Support Community forums, not for help with specific programs. Product questions should be posted in the associated product community.

    Inspiring
    June 25, 2021

    Sorry for not being specific. I am using Adobe Acrobat ProDC and I have to get some actions into a pdf-file using JAVAScript. One action is, that , when clicking a button, a value in a textfield has to be calculated and the color has to be changed. I tried to code it in the way described. Assigning the new value to the field works, but assigning new colors does not work. I checked the api, but did not find a solution.

    All the best

    Ben

     

    Moving from Using the Community (which is about the forums) to the correct forum... Mod
    To ask in the forum for your program please start at https://community.adobe.com/