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

Controlling whether a checkbox gets printed

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

0 Replies

Avatar

Level 4

The relevant="+print" doesn't work for me, but if i leave the string empty it works fine.

I've attached an example.

Avatar

Level 3

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

Avatar

Level 4

It might.

If it doesn't, post your form so i can have a look at it.

Avatar

Level 3

Here is the form that I am tinkering with. The relevant field is the checkbox with the caption "Print?"

Any thoughts?

Thanks

Avatar

Level 4

Your PDF is still queued.... try to post it again.

Avatar

Level 3

Again the objects are near the top of the form

Avatar

Correct answer by
Level 10

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