Checkbox Issue

Feb 14, 2018

Copy link to clipboard

Copied

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

Views

120

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

Checkbox Issue

Feb 14, 2018

Copy link to clipboard

Copied

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

Views

121

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
Feb 14, 2018 0
Most Valuable Participant ,
Feb 15, 2018

Copy link to clipboard

Copied

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

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
Reply
Loading...
Feb 15, 2018 0
Feb 15, 2018

Copy link to clipboard

Copied

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

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
Reply
Loading...
Feb 15, 2018 0
Most Valuable Participant ,
Feb 15, 2018

Copy link to clipboard

Copied

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

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

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
Reply
Loading...
Feb 15, 2018 0
Feb 15, 2018

Copy link to clipboard

Copied

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

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
Reply
Loading...
Feb 15, 2018 0
Feb 15, 2018

Copy link to clipboard

Copied

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

found this one, it works.. thanks!

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
Reply
Loading...
Feb 15, 2018 0
Feb 16, 2018

Copy link to clipboard

Copied

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?

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
Reply
Loading...
Feb 16, 2018 0
Participant ,
Feb 21, 2018

Copy link to clipboard

Copied

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!

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
Reply
Loading...
Feb 21, 2018 0