Hi guys
I'm attempting to control whether or not a checkbox object is displayed when printed, based on whether or not the box is checked.
I only want the checkbox object to be printed if the checkbox is checked. It should be visible to the user regardless.
I have created a simple script that I believe should do the job, but the checkbox object prints regardless of its state.
form1.#subform[0].CheckBox1::change - (JavaScript, client)
if (this.rawValue == 1) {
this.relevant = "+print";
}
else {
this.relevant = "-print";
}
It can be noted that I am adjustng the 'relevant' attribute, in response to the 'change' event.
Any ideas on where I have gone wrong??
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Ok I just tried it and your code is fine. You have to save the form as dynamic for those changes to take effect. Do a File/SaveAs and choose dynamic PDF and try it again.
Paul
Views
Replies
Total Likes
The relevant="+print" doesn't work for me, but if i leave the string empty it works fine.
I've attached an example.
your example works, yet when I use the exact same code on checkboxes in my own form, they either never print or always print.
can the presence of other fields on the page alter the .relevant attribute? should we be assigning the script to the prePrint event,
since that's the only time that it is truly relevant?
If it can be attached to the prePrint event, I think that would save me some work as I will be having many checkboxes,
and I could just go with a for loop that cycles through each and checks the rawValue of each.
Would that work?
Thanks
Views
Replies
Total Likes
It might.
If it doesn't, post your form so i can have a look at it.
Views
Replies
Total Likes
Here is the form that I am tinkering with. The relevant field is the checkbox with the caption "Print?"
Any thoughts?
Thanks
Views
Replies
Total Likes
Your PDF is still queued.... try to post it again.
Views
Replies
Total Likes
Again the objects are near the top of the form
Views
Replies
Total Likes
Ok I just tried it and your code is fine. You have to save the form as dynamic for those changes to take effect. Do a File/SaveAs and choose dynamic PDF and try it again.
Paul
Views
Replies
Total Likes
Views
Likes
Replies