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

Checkbox Issue

Community Beginner ,
Feb 14, 2018 Feb 14, 2018

so i created a checkbox which will hide fields when checked (mouse up)

why dont the values come back when the box is unchecked? how do i do this?

TOPICS
Acrobat SDK and JavaScript
382
Translate
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
Community Expert ,
Feb 15, 2018 Feb 15, 2018

How did you set it up? Did you use a script? If so, post the code you used.

Translate
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
Community Beginner ,
Feb 15, 2018 Feb 15, 2018

no, i just went through properties and used actions and put each field individually that i wanted hidden.. figuring if u uncheck the box they would reappear, which doesnt happen

Translate
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
Community Expert ,
Feb 15, 2018 Feb 15, 2018

If you want it to be conditional you have to use a script.

See: https://acrobatusers.com/tutorials/show_hide_fields

Translate
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
Community Beginner ,
Feb 15, 2018 Feb 15, 2018

okay ill try figure this out, i have no experience with this stuff

Translate
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
Community Beginner ,
Feb 15, 2018 Feb 15, 2018

if (event.target.value != "Off") {// box is checkedthis.getField("var1").display = display.visible ;this.getField("var2").display = display.visible ;} else {// box is uncheckedthis.getField("var1").display = display.hidden ;this.getField("var2").display = display.hidden ;}

found this one, it works.. thanks!

Translate
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
Community Beginner ,
Feb 16, 2018 Feb 16, 2018

followup, the script works.. just changed the hidden/visible for if its checked or not.. but is there a way i can just make a dropdown choice that is on the form automatically check the box?

Translate
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 ,
Feb 21, 2018 Feb 21, 2018
LATEST

You can add a validation script on the dropdown menu:

In the below example the choices in the dropdown are  'y' , 'n', '  ' or anything other than that. And adjusts the value of field f. but can be used for anything you'd like.

var f = this.getField("texterino")

if (event.value=="y") {

    f.value = 'y'

}else if (event.value=="n")  {

    f.value = 'n'

}else if (event.value==" ")  {

    f.value = '   '

} else { f.value = 'else' 

}

Hope this helps!

Translate
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