Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Preserve Script Changes for Drop-down

Avatar

Level 4

I have a drop down list that changes color depending on selection.  See script below.

form1.Page1.Status.DDlist1::change - (JavaScript, client)

switch(xfa.event.change)

{

case "Green":

this.ui.choiceList.border.fill.color.value = "0,128,0";

break;

case "Yellow":

this.ui.choiceList.border.fill.color.value = "255,255,0";

break;

case "Red":

this.ui.choiceList.border.fill.color.value = "255,0,0";

break;

case " ":

this.ui.choiceList.border.fill.color.value = "255,255,255";

break;

}

This works fine if the user does not save the form.  When the form is saved, the color does not hold.

I have Adobe Designer ES, however, I have Acrobat 7.0 so I don’t have the luxury of selecting the Automatic option in the Preserve scripting changes to form when saved - it is not supported. 

Can someone provide a script to hold the color selection.

Thanks!

4 Replies

Avatar

Level 6

I tried your code with Acrobat 9 and it saves the color and the value...

However if it does not work I would look in to alternative methods to force it to run the same script with minor changes at the time of docReady/formReady to make it look like it saved the color....

switch

(this.rawValue)

{

case

"Green":

this.ui.choiceList.border.fill.color.value

= "0,128,0";

break

;

case

"Yellow":

this.ui.choiceList.border.fill.color.value

= "255,255,0";

break

;

case

"Red":

this.ui.choiceList.border.fill.color.value

= "255,0,0";

break

;

case

" ":

this.ui.choiceList.border.fill.color.value

= "255,255,255";

break

;

}

Good luck,

Avatar

Level 9

Hi Michelle,

Just for your reference check the following :

Click on File -> Form Properties -> Defaults -> Under Preserve scripting changes to form when saved : Click" Manually".

Thanks,

Bibhu.

Avatar

Level 4

Thanks but this doesn't work for me. The version of Acrobat I'm using does not support this.

Avatar

Level 4

I figured it out, I added script to the formReady event.