Skip to main content
erics82320798
Participant
April 30, 2021
Answered

Javascript advice when hiding checkboxes (so the checked box isn't also hidden)

  • April 30, 2021
  • 1 reply
  • 357 views

I have a java action setup for a checkbox called: "template.specialty_sport_aerobic"

 

This is the code:

this.getField("template").display = (event.target.value=="Off")?display.visible:display.hidden;

 

I have many checkboxes this applies to, but here are the names of two of them:

"template.specialty_sport_supersport"

"template.specialty_sport_polyathletic"

 

Here is what works great:

When I check "template.specialty_sport_aerobic", both of these are hidden

"template.specialty_sport_supersport"

"template.specialty_sport_polyathletic"

 

Here is my problem:

When I check "template.specialty_sport_aerobic", it also hides itself (and therefore cannot be unchecked).

Is it possible to add something to this script such that the box being checked will not be hidden?

 

Thank you!

This topic has been closed for replies.
Correct answer try67

You can do it by adding this line of code to the end of your script:

 

event.target.display=display.visible;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
April 30, 2021

You can do it by adding this line of code to the end of your script:

 

event.target.display=display.visible;