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

LiveCycle - javascript hide/show whole table

Avatar

Not applicable

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,

1 Accepted Solution

Avatar

Correct answer by
Not applicable

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

View solution in original post

0 Replies

Avatar

Level 2

Hi bozely,

try this:

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

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

} else {

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

Regards

Dietmar

Avatar

Not applicable

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.

Avatar

Level 2

Hi Bozely,

the code is working on my machine - no clue why it doesn't work on yours.

Which LC Version are you using?

Best

Dietmar

Avatar

Not applicable

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.

Avatar

Not applicable

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,

Avatar

Not applicable

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?

Avatar

Correct answer by
Not applicable

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

Avatar

Level 2

great you got it working - and thanks for posting the solution

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 81, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 81, column 5] ----