Hello all.
I am trying to create a static PDF where the user can choose to hide certain sections.
The concept :
The challenge :
I have attached the XDP that I am using ( Adobe LiveCycle ES2 , v9.0.0.2)
I do a SaveAs a static PDF (attached) for general use ( Static because I want to run this on an iPad )
Can anyone shed light on why this works without an IF statement but does not when enclosed in an IF statement ?
Any other solutions would help
Thanks for your help
Aubrey Fernandes
The code :
form1::initialize - (JavaScript, client)
//Hides any sections depending on the Checkbox state
if ( Page_Main.sfButtons.table_CE.rowCE1.CheckBox1.rawValue == 0 ) { Page_CE.sfCE1.presence = "hidden"; }
if ( Page_Main.sfButtons.table_CE.rowCE2.CheckBox1.rawValue == 0 ) { Page_CE.sfCE2.presence = "hidden"; }
if ( Page_Main.sfButtons.table_CE.rowCE3.CheckBox1.rawValue == 0 ) { Page_CE.sfCE3.presence = "hidden"; }
if ( Page_Main.sfButtons.table_CE.rowCE4.CheckBox1.rawValue == 0 ) { Page_CE.sfCE4.presence = "hidden"; }
//Shows any sections depending on the Checkbox state
if ( Page_Main.sfButtons.table_CE.rowCE1.CheckBox1.rawValue == 1 ) { Page_CE.sfCE1.presence = "visible"; }
if ( Page_Main.sfButtons.table_CE.rowCE2.CheckBox1.rawValue == 1 ) { Page_CE.sfCE2.presence = "visible"; }
if ( Page_Main.sfButtons.table_CE.rowCE3.CheckBox1.rawValue == 1 ) { Page_CE.sfCE3.presence = "visible"; }
if ( Page_Main.sfButtons.table_CE.rowCE4.CheckBox1.rawValue == 1 ) { Page_CE.sfCE4.presence = "visible"; }
//for debug, I forced hid the 4th section - This works but above code does not !
Page_CE.sfCE4.presence = "hidden";
Views
Replies
Total Likes
I was unable to attach the files - Looks like the upload file feature has been disabled
Views
Replies
Total Likes
Since I can't see the form, I'm just guessing: The problem might be in your condition. Are those rows named rowCE1, rowCE2, etc.? Or are they actually all named rowCE, and they have an index behind them?
If looking at that doesn't help, would you paste a screenshot of your hierarchy in a reply for us? That lets us see the names of fields and the path to them. Also, include the script window in your screen shot, if possible, so we can look at the event that is supposed to trigger the script.
Views
Replies
Total Likes
Thanks J
The field names are correct.
It is not an issue with the field references.
Case in point : The last statement Page_CE.sfCE4.presence = "hidden"; works perfectly.
Almost as if the IF statement is not considered a part of the initialize script.
Aubrey
Views
Replies
Total Likes
I wonder if you've got a race condition here. As the first few if statements are being processed, the objects in the conditions haven't been initialized, yet, so it doesn't know what to do with them thus making the condition false. And by the time it gets to the regular statement at the end, the subform HAS been initialized, so it can make it hidden. If statements are certainly processed in the initialize event; though, I have never tried to use one in the initialize for the form itself.
I might recommend you put this in the layout:ready event for your form, but be aware that the form itself reports back that the layout is ready A LOT! So, this might harm the performance of your PDF.
As a test, I was able to get a form to do what you're asking, but there are only two objects in the form. a checkbox and a subform. After that test, I really feel that the issue is with how much you are having to do in your form to initialize and whether all of the objects have been loaded before your form starts going through your script.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies