I created a form in LiveCycle Designer.
The form has subform2 defined as "positioned" and "Visible".
The form contain text objects, text fields and image fields. Each of them has size and position defined.
At the run time I want the objects inside the subform to become invisible depending on a field value. So i put the code in Subform2 on DocReady event:
[i]console.println("in Subform2- docready");
var TotExclTax = data.Main.APPENDIX.TOTAL.Sum.TOTEXCLTAX.FKWRT.rawValue;
console.println("TotExclTax="+TotExclTax);
if (TotExclTax == 400000)
{
this.presence = "invisible";
console.println("equal 400000");
}[/i]
At the runtime I see the message "equal 400000" in the console.
This means that statement [i] this.presence = "invisible";[/i] gets executed.
But objects in the subform stays visible!
How to make all the objects in subform Invisible?
I thought that making subform invisible will automatically make all objects inside the subform invisible too...
You might try putting the script on the initialize event of the form. I did something similar (though I based my show/hide on a form variable) and it works. Here's an example of the code I used:
if (varJobTitle == "AE") then
form1..Table1.Row[2].presence = "hidden"
form1.msubform.rating[2].presence = "hidden"
endif
This code hides both an individual table row and an entire subform. I used FormCalc, but with a few syntax tweaks the code should work in js too. Also, I chose "hidden" because I wanted the row excluded from the layout, but the script should work fine with "invisible" too.
Hope this is helpful--
Kathryn