check whether a checkbox is checked and then perform actions using javascripting

Dear Experts:

I got a single Checkbox named 'MyCheckBox' on an acrobat form.

I would like to run a javascript on that CheckBox with the following requirments:

If MyCheckBox gets checked, the script should ...
... check whether a radio button "MyRadionButton" with the export value 'Sliding Door' is activated ... if yes ...
the following actions are to be performed:
this.getField("sl2").readonly = false ;
this.getField("sl2").required = true ;
this.getField("sl2").fillColor = color.white ;

... else MyCheckbox gets unchecked
... do other stuff

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Andreas HermleTeam leaderAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
This goes in the exit event of the checkbox
// If a checkbox value is Off - it is not checked otherwise it is set to the
// value of the CB.
if (this.getField('MyCheckbox').value != 'Off') {
  if (this.getField('MyRadionButton') == 'Sliding Door') {
    this.getField("sl2").readonly = false ;
    this.getField("sl2").required = true ;
    this.getField("sl2").fillColor = color.white ;
  }
}
else {
  // this is where you handle the checked off code
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andreas HermleTeam leaderAuthor Commented:
Great Julian,

this did the trick. Thank you very much for your valuable help. I really appreciate it.

Regards, Andreas
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Acrobat

From novice to tech pro — start learning today.