Button 'toggle' between colours and field visible or hidden?

Participant ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

Hi all,

 

Am wondering if it is possible to get a 'toggle' button (that alternates between border colour RED and TRANSPARENT) to also execute some script that will make 3 fields visible or hidden as shown below? e.g. if button pressed and border colour is RED, then the scenario "PRESS BUTTON (if border colour is RED)" shown below should be the case, and if border colour is TRANSPARENT, then the "PRESS BUTTON (if border colour is TRANSPARENT)" case should then be true.

 

The code below is what I have that alternates between the RED and TRANSPARENT border colours for the 'toggle' button (when pressed);

 

event.target.strokeColor = color.equal(event.target.strokeColor, color.transparent) ? color.red : color.transparent;

 

And this is the code I would like to alternate (if even possible!?) between button 'toggle' presses as outlined in my first paragraph;

 

PRESS BUTTON (if 'Fill Colour' is RED)

 

this.getField("Voidtext1").display = display.visible
this.getField("Swapupper1").display = display.hidden
this.getField("Weightupper1").display = display.hidden
}

 

PRESS BUTTON (if 'Fill Colour' is TRANSPARENT)

 

else{

this.getField("Voidtext1").display = display.hidden
this.getField("Swapupper1").display = display.visible
this.getField("Weightupper1").display = display.visible
}

 

TOPICS
PDF forms

Views

115

Likes

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 1 Correct Answer

Adobe Community Professional , Apr 08, 2021 Apr 08, 2021
Try this: if(color.equal(event.target.strokeColor, color.transparent)){ event.target.strokeColor = color.red; this.getField("Voidtext1").display = display.hidden; this.getField("Swapupper1").display = display.visible; this.getField("Weightupper1").display = display.visible;} else if(color.equal(event.target.strokeColor, color.red)){ event.target.strokeColor = color.transparent; this.getField("Voidtext1").display = display.visible; this.getField("Swapupper1").display = display.hidden; this.getFie...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

Try this:

if(color.equal(event.target.strokeColor, color.transparent)){
event.target.strokeColor = color.red;
this.getField("Voidtext1").display = display.hidden;
this.getField("Swapupper1").display = display.visible;
this.getField("Weightupper1").display = display.visible;}
else if(color.equal(event.target.strokeColor, color.red)){
event.target.strokeColor = color.transparent;
this.getField("Voidtext1").display = display.visible;
this.getField("Swapupper1").display = display.hidden;
this.getField("Weightupper1").display = display.hidden;}

Likes

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
Participant ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

LATEST

Ni Nesa,

 

That's absolutely perfect! many thanks for the response, as always - bang on the money! 😉

Likes

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