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
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
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.
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/
Copy link to clipboard
Copied
Replace textcolor with textColor and fillcolor with fillColor...
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?
Copy link to clipboard
Copied
Where do you use script?
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.
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;
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
Copy link to clipboard
Copied
Disable the field highlighting.
Copy link to clipboard
Copied
I tried this:
app.runtimeHighlight = false;
it works!
thank you all so much for your help
-ben from the now warm Eifelmountains in Germany