Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Printing invisible fields

Avatar

Level 4

I have a couple of forms that have invisible fields that I have scripted to become visible only when the user selects "Yes" on certain radio buttons when completing the form in Reader. They work great, but the problem is that we have some "old school" users who still prefer to print the forms and then fill them in by hand (sometimes you just can't teach old dogs new tricks!). We are ok with this, but what this means is that the invisible fields are not printing. I thought maybe by changing them to "Visible (Print Only)" would fix that problem, but then they do not show up for the majority of users who do actually fill out the form digitally.

Is there any way to set these fields so that they will show up if the user prints out a blank form for completing by hand?

Maybe a pre-print script that says "If [one of the required fields] is blank (which would mean the user is most likely printing a blank form), then change the "Invisible" fields to "Visible"? How would this script look?

Or is there an easier way?

Thanks for any help!

Jo

1 Accepted Solution

Avatar

Correct answer by
Level 10

I don't think the radio button has a null value, try testing against "".

N.

View solution in original post

10 Replies

Avatar

Former Community Member

Yes you can change the field to make it visible on preprint, then I suggest changing it back on postprint. The property you want is presence. So simply specifiy the fields name and add a .presence = "visible" for the preprint and fieldname.presence = "invisible" on the post print. You will need one of these statements for each field that you want to change.

Hope that helps

Paul

Avatar

Level 10

Hi,

There is a property you can control using script, called 'relevant'. This controls whether an object will be printed, irrespective of its presence.

You need to use two lines of script with this, in the prePrint event:

this.presence = "visible";

this.relevant = "+print";

Now this means that it will always print, even for users who have not selected the radio button. You could probably test the value of the radio button, but that is probably complicating it too much.

Paul Guerette is giving a talk on dynamic forms on the 30 November: http://acrobatusers.com/events/49326/tech-talk-developing-flowable-form-content

Niall

edit: actually Paul's solution is much simpler...

Avatar

Level 4

Thanks to you both. I did try Paul's method and while it works great for users who print the form to hand fill it, it causes a slight problem for users who enter it in Reader because when you fill it out (digitally), then print it, the post-print fields go invisible. Not a problem for users who have already printed their completed forms, but sometimes users do not print them but email them back to us. In these cases, these fields are not invisible and we need to view the data in them.

Is there an initialize script that would make them visible again after printing?

edit - Actually, after saving and reopening, the form looks fine. It's just after printing, the fields that have had data entered into them are invisible on the screen...which might be alarming to someone filling out the form.

Avatar

Level 10

Hi,

Here is an example:

https://acrobat.com/#d=nc*9utitcOqhUWSsgCzcqQ

It uses the presence and relevant properties. Check out the script in the click event of the radio button group and the docReady event of the textfield.

Note that you need to use the presence and relevant scripts as a pair.

Hope that helps,

Niall

Avatar

Level 10

I've uploaded a slightly different version: https://acrobat.com/#d=nc*9utitcOqhUWSsgCzcqQ

The docReady event of the textfield fires the radio button group click event. Which I think will be more robust when reopening a completed form.

N.

Avatar

Level 4

Thank you Niall. This one does work better. The only problem here is that a default value is assigned to the radio button. This is fine for on-screen form filling, because it keeps the text field invisible unless you click "visible". The problem it causes is that for users who want to print and fill the form, one of the responses "invisible" is already selected. They would have to either mark out that selection or use white-out to change it to the other radio selection.

Avatar

Level 10

Hi,

You could try two print buttons, one of which is 'Print a blank form'.

This would make the objects visible, print and then hide the objects again.

If the form is brief and not complex, say one page, then you could duplicate it onto a second page and make this how you want to appear for filling in by hand. For example solid box instead of 3d borders. The print blank button would hide page1 and show the blank page, print it and then hide it again.

There are probably a few ways around your problem, its just a case of deciding which suits you best.

Niall

Avatar

Level 4

I thought that putting the following script in the pre-print event for the radio button list would work:

//make text field visible upon printing if neither are selected

if (this.rawValue == null)
{

textfield.presence = "visible";
}

...but it still isn't showing the field upon printing...why is that?

Anyway, maybe I'll go that route...the print button for printing just a blank form. Since 90% of our users are going to be filling and submitting it electronically, I think it may be best to suit the majority.

Thanks for helping out with this.

Avatar

Correct answer by
Level 10

I don't think the radio button has a null value, try testing against "".

N.

Avatar

Level 4

"" works!

I think it's working now for the most part! What I ended up doing is:

In the click event for changePresence:

//if the user clicks Yes, the text field becomes visible

//if the user clicks No, the text field stays invisible

if (this.rawValue == 1)
{
myName.presence = "visible";
}
else
{
myName.presence = "invisible";
}

In the pre-print event of myName:

//If neither radio button selections are chosen, make text field visible and print

if (changePresence.rawValue == "")
{
this.presence = "visible";
}

In the post-print event of myName:

//If neither radio button selections were chose before printing, make them invisible again

if (changePresence.rawValue == "")
{this.presence = "invisible";}

Thank you for all your help working through this Niall!

Jo