Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamic Subform not showing up after saving and opening.

Avatar

Level 1

After I fill out the pdf, save it, and open it, the dynamic subform does not appear. There are currently 2 subforms that are controlled by checkboxes and function in the following manner:

-If the "No" checkbox is checked, the "SubmissionNo" subform should appear, the "Submission" subform should be hidden, and the "Yes" checkbox should be unchecked

-If the "Yes" checkbox is checked, the "Submission" subform should appear, the "SubmissionNo" subform should be hidden, and the "No" checkbox should be unchecked

Both checkboxes default to being unchecked and save properly, but after I close the pdf and then open it, the appropriate subform that should be showing is still hidden despite having the "Yes" or "No" checkbox being checked.

I have the following script in the docReady of SubmissionNo:

if (noCheckBox.rawValue=0){

this.presence = "visible";

}

else{

this.presence = "hidden";

}

and I have the following script in the docReady of Submission:

if (yesCheckBox.rawValue=0){

this.presence = "visible";

}

else{

this.presence = "hidden";

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Couple of things:

Your if statements aren't correct - you need two equal signs to test a value not one. So, if (noCheckBox.rawValue = 0) should be if (noCheckBox.rawValue == 0)

In File>Form Properties on the Defaults tab make sure that "Preserve scripting changes..." is set to Automatically.

View solution in original post

14 Replies

Avatar

Correct answer by
Level 10

Couple of things:

Your if statements aren't correct - you need two equal signs to test a value not one. So, if (noCheckBox.rawValue = 0) should be if (noCheckBox.rawValue == 0)

In File>Form Properties on the Defaults tab make sure that "Preserve scripting changes..." is set to Automatically.

Avatar

Level 3

I using the same script for a checkbox but it's not working properly.  When I check the box, other information becomes visible - that works fine.  But it won't uncheck so that the information then disappears and this is very problematic.  I've got the script on the Initialize and the Change events, Perserve Scripting Changes is set to Automatically.  Render Format is for Dynamic and it is saved as such also.

Any guidance you can give?

Thanks!

Avatar

Level 10

You shouldn't need it on the Initialize event, the Change event should be fine.

Can you post your script?

Avatar

Level 3

Removing from the Initialize event didn't work - now the information just shows all the time whether or not the box is checked.

Here's the script:

 

if

(litstudiesckkbox.rawValue==1)

    {subform1.presence = "visible"}

else

    {subform1.presence = "hidden"}

Avatar

Level 10

That should work. You're missing semicolons after each statement and I thought that might be tripping it up but it worked fine when I tested it, every statement in JavaScript should end with a semicolon but if there is just one line I guess it works ok (see below).

if (litstudiesckkbox.rawValue==1) {

     subform1.presence = "visible";

}

else {

     subform1.presence = "hidden";

}

When you are in Acrobat press CTRL-J and the JavaScript console should open. Then click the checkbox and see if any error messages appear in the console window.

If that doesn't show anything if you can share your form via acrobat.com (or some other file sharing site) then I can take a look. If you use acrobat.com then once you have uploaded the file you need to select it and Share it and then Publish it, then you can paste the link here.

Avatar

Level 3

I still couldn't get it to work.  I uploaded it here:  https://acrobat.com/#d=OaiK-J0VLEy*S2bENSc*8w

I really appreciate any help.

Thanks so much!

Avatar

Level 10

The problem is that it isn't a checkbox, it's a radio button - radio buttons are meant to be used in an "exclusion group" which means you can only select one of one or more options and you can't uncheck them without scripting. You'll see in the hierarchy that your button is grouped under an object called "RadioButtonList".

To change it to a checkbox click on your litstudiesckkbox (in the hierarchy palette) and then on the Object palette on the Field tab change the Type from Radio Button to Check Box.

The other checkbox you have to the right is set up correctly as a checkbox.

The script on the Initialize event looks ok as it's being used to set the initial visibility of the subform.

Avatar

Level 3

Thanks so much for taking a look . . .

Sorry, the left is set as a radio button - I was testing to see if a radio button would work and obviously, it didn't.  Yes, the right was set as a checkbox, but it doesn't work either (for me anyway).    

At any rate, I did change it to a checkbox but no luck - it still won't uncheck for me.

** Did the right checkbox uncheck for you?

Avatar

Level 10

Yes, the checkbox on the right worked fine for me. And the left one did once I switched it to being a checkbox.

Not sure what the problem would be. What version of Acrobat or Reader are you using to test?

Here's the version I tested.

https://acrobat.com/#d=Jv9*SVKwJSGxnElnWdXitg

Avatar

Level 3

Well, I had version 10 but it didn't work when tested.  So I got rid of that and downloaded 9.5 and it worked.

What version did you use?

Do you have any idea why it wouldn't work for 10?  In form properties under Target Version, I created the form to work in Reader 8.1 or later.  Do I need to change it to 9.0 or later (i.e. will it work with Reader 10 then)?

Avatar

Level 10

I'm running 9.5. Not sure why it wouldn't be working in 10. I have version 10 at home so I'll take a look tonight if I can.

The target version is for the minimum version you want the form to be able to work with.

Avatar

Level 3

Well, I'm very sorry to put you through all that just to discover it doesn't like the version I was using.  At any rate, I do thank you very much for your help and your time - I always learn something new in the process whether it's directly related to my question or not.

If you do discover some secret about why it won't work in 10 or how to make it so, then please let me know.

For now though - thanks again!

Avatar

Level 10

So I'm not sure what, but there's something weird going on in your form.

I tried several variations of scripts and something always didn't work quite right. I also tried doing it in FormCalc instead of JavaScript and got similar results.

If I create a new form with a checkbox and a subform and show and hide the subform from the checkbox it works fine in Acrobat 10. With your form I got it almost working but it would only work around twice and then just stop working.

So there may be some sort of corruption in the form. There's also a lot of calculation scripts going on so perhaps something is getting in the way there, I'm just not sure.

Avatar

Level 3

Ah, well - that explains a lot then.  Again, thanks so much for your help!