These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Combo Box Text changes

SymmetryMedical
Registered: Apr 21 2010
Posts: 26

Hi

Hopefully a nice simple one but I can't get it to work. Basically we have a form with an Combo Box on it, Yes, or No, In the paper version of the Form, if Yes is circled then they Red Rubber Stamp it to make sure it's very visible that Yes has been selected as extra work then needs to be done.

I'm trying to do something similar here, something simple like having Yes in Red and Bold, or make the combo box background red to make it stand out but I don't seem to be able to change it for one selection only, it's all or nothing.

So I'm guessing the answer is javascript, which I don't really know at all, I can't find anything about this problem in the forums but I've found a few different bits of code that look like it might work but I can't seem to make anything happen by sticking it all together.

This is what I'm trying in custom keystroke:

var s = this.getField("combo1");

if (s.value == "Yes")
{
combo1.fillColor = color.red;
}

Now I've no idea if it's the right code in the wrong place, the wrong code in the right place, or is just completely wrong. Can anyone shed some light or suggest an easier way?

My Product Information:
Acrobat Standard 9.3.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You also need code a change for the other possible selections or the "non-Yes" selections. This is needed because someone could go back and change the selection and you need to provide the code to reflect this change.

George Kaiser

SymmetryMedical
Registered: Apr 21 2010
Posts: 26
Good point, I'll add code in for the others although once the selection is made it's locked in with a signature but I still need to provide code in case they change it before locking it.

However the code I have used doesn't work. It makes no change at all and I don't even know where to begin troubleshooting it.


*********************

Edit: I've been struggling with this for a week now but I can't figure out how to get a combo box to make changes based on an if statement.

var a = getField("Combo1");
var b = getField("Notes1");

if(a.valueAsString == "Yes")
{
b.fillColor = color.black;
}

if(a.valueAsString == "No")
{
b.fillColor = color.red;
}

Is the basic code I'm using now, or trying to. I've tried it in custom keystroke script and also in custom calculation script, neither one seems to have any effect, can anyone shed any light please?