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

changing colors of a textfield through clicking a button

Explorer ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

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

Views

1.4K

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

correct answers 2 Correct answers

Community Expert , Jun 25, 2021 Jun 25, 2021

Disable the field highlighting.

Votes

Translate

Translate
Explorer , Jun 25, 2021 Jun 25, 2021

I tried this:

app.runtimeHighlight = false;

it works!

thank you all so much for your help

-ben from the now warm Eifelmountains in Germany

Votes

Translate

Translate
Community Expert ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

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.

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

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/

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

Replace textcolor with textColor and fillcolor with fillColor...

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

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

Any idea?

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

Where do you use script?

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

I checked it again. I use the script in a form with the onclick-event of a button.  The textColor of the textField is changed and can be seen. To see the changed fillColor of the textField, i have to click into it.  Then the fillColor is seen. After leaving the textfield, the colour falls back to white. Is it possible, to make the fillColor seen whitout clicking into the textField.

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

You sure you fixed it correctly?

See if this works:

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;

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

Great. The solution must be near. The textColor is changed to red and the fillColor is changed to blue. But I still have this, for me strange effect, that the textcolor in the textfield is red and can be seen alltime. The fillcolor only changes to blue, when i set the focus into the field with clicking my mouse in the field. When leaving the field, it rechanges to white. Is there a solution to make the fillColor be seen alltime?

all the best

ben

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 ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

Disable the field highlighting.

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

LATEST

I tried this:

app.runtimeHighlight = false;

it works!

thank you all so much for your help

-ben from the now warm Eifelmountains in Germany

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