LiveCycle - javascript hide/show whole table

Bozely

16-12-2015

I feel like I am going crazy,

I have a check box and a table on a LiveCycle PDF Form, when I select the checkbox I want a table to appear, and when unticked, disappear.

I have simplified the document to show CheckBox1 (Checkbox from Standard menu) and Table1 (Table from Standard menu), I have enabled javascript in the scripting window for all events on the change event for the checkbox entered the following code


if(this.rawValue == 0){


   form1.Table1.presence = "hidden";


} else {


   form1.Table1.presence = "visible";


}



If I set the initialize script to


form1.Table1.presence = "hidden";



The table is not visible as expected but the checkbox method does nothing... I've watched a video on YouTube and followed every last detail, even copying his example and my system does nothing!!! arghhhghhghghgh...

What have I missed? Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Bozely

22-12-2015

Thanks everybody, for all the tutorials I read and watched everyone failed to mention file types before they got started.

My form was set to STATIC, meaning it would render only once, my code was good but the page simply doesn't rerender so it would appear to do nothing. The dynamic parts, or the inputs of fields appear to be the only things affected on static forms hence the behaviour I mention in one of my previous comments.

I had previously tried a dynamic form which didn't work either but needed to do the following setting changes to get it working...

  1. Open LiveCycle->Tools->Options->Document Handling
  2. Change "Default File Type for New Forms" to "Dynamic XML Form" (so that you may never suffer at the hands of this evil again!!!)

Then fix your preview in LiveCycle

  1. File->Form Properties->Defaults->PDF Render Format
  2. Set to "Dynamic XML Form"
  3. Go to the "Preview Tab"
  4. Set Preview Type to "Interactive Form"
  5. Set Preview Adobe XML Form As to "Dynamic XML Form"

And bingo... Hope this helps some other noob. Thanks again Broklynitealassir

Answers (8)

Answers (8)

Broklynite

21-12-2015

Going out on a limb here, I admit. You said that you've set it to hidden in the initialize event, while the rest of this is in the change event. Just on the off chance, have you tried doing the following:

1. comment out the hidden code in the initialize event

2. select the table in the object hierarchy.

3. Object tab - Subform tab - Presence, select Hidden

I'm absolutely not a programmer, I'm just a guy who has been flailing at this stuff for a couple of months now. I've tended to notice that the software isn't always happy about multiple state declarations that are mutually exclusive. So by setting it to hidden by default rather than having it be visible by default and then subsequently commanding it to be hidden and then commanding it to be visible...

Look, I know it's stupid, and it shouldn't work that way. But it will take two seconds to try. If it doesn't work, what have you really lost?

Bozely

16-12-2015

Ok, if I add a TextField and fill it with some text and run my code the check box will hide and unhide the text inside the textbox, I couldn't see this as the textbox I using was blank (doh!).

But I want to hide the whole object... How to do this?

Thanks,

Bozely

16-12-2015

Hi Dietmar,

I'm currently using LiveCycle 8.0.

Currently this code will only work when in the initialised event, if it is placed in any other event it doesn't fire. I do not understand why...


this.presence = "hidden";


Thanks again for your assistance.

Bozely

16-12-2015

Thanks Alassir, although, your suggestion did not resolve the issue. I've got a feeling this is a set up issue, the code is stock. I'm reading the manuals and have plenty of other code working but this just doesn't want to work.

alassir

16-12-2015

Hi bozely,

try this:

if (this.rawValue == "1") {

  this.resolveNode("Table1").presence = "visible";

} else {

  this.resolveNode("Table1").presence = "hidden";

Regards

Dietmar