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

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

Engaged ,
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

426

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

Community Expert , 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.getField("Weigh

...

Votes

Translate

Translate
Community Expert ,
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;}

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
Engaged ,
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! 😉

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