Expand my Community achievements bar.

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

Script to omit field borders from printing is not working this time.

Avatar

Level 7

I have several forms where I used the scripts that I received from Niall to stop the field borders from printing that work perfectly. Now, I have a form where I think I've done entered the scripts the same, but the printing of the field borders is not suppressed. The difference between this form and the previous forms, is the current form has a number of subforms within the page 1 subform. Not sure if this could be the problem.

I'm attaching the form where the field borders are printing but I want them suppressed. These are the date, name and supervisor names at the top of the form where the border should not print. The underline in the signature lines should print.

Thanks,

mdawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Margaret,

I am not sure if you saw the example I uploaded onto the thread, but in any case here is an updated version.

Basically there are example of textfields with borders / underlines / fill colours, which change visually depending on user actions or printing. Hopefully you can following the differences between accessing the border properties and the fill properties. Once you are happy with this, it just depends on which event you put the script into.

On your form that you posted, I could see the green on the screen during as the prePrint event fired.

In the example I am uploading I have an example of a textfield with an underline. LC achieves an underline by applying a solid box and hiding three of the sides (top and both sides). Therefore when accessing the remaining side (the bottom of the box) you do not need to go through a loop, you can just access that one side.

I am probably not making myself clear on this. I think looking at the examples may help you.

The solutions are probably not the only way to achieve this effect, but it is the way that I have developed based on other people's solutions on the forum and blogs.

I hope that there are of help to you,

Niall 

View solution in original post

5 Replies

Avatar

Level 10

Hi,

Please bear with me 'cos I am not connected to a printer at the moment.

Looking at the PDF the fields at the top of the page do not have a border (just an underline) therefore if should print out as it appears on the screen without additional script.

The script in the prePrint and postPrint events of the five fields relate to the fill and not the border. You can see that after printing the five fields appear light green (225,255,225).

I would delete the script in each of the five fields, as you have selected no borders in the design and therefore you do not need to script then out for the print.

Script for the fill looks like:

var vName = this.somExpression;

var fieldObj = xfa.resolveNode(vName + ".ui.#textEdit.border.fill.color");



Whereas script for borders can look like:

xfa.resolveNode(vName + ".ui.textEdit.border.edge").stroke = "solid";

Let me know if you need some examples,

Niall
ps here are some example of user actions versus prePrint and postPrint

Avatar

Level 7

Thanks Niall.

I'm not sure what I did before, but using the scripts for prePrint and postPrint suppressed the underline from printing in previous forms. The scripts work differently in the form that I attached.

And I'm not seeing any background fill, but I am printing to a black and white printer. I'll try this on a color printer too.

What I would like to have happen is the underline or sunken box to appear on the screen so the user sees the field and then the underline or box to not print.

It sounds like from your explanation that setting appearance (underline or sunken box) is different than selecting a border. Am I understanding this correctly?

I'd appreciate any help you can give me. And thanks again.

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Correct answer by
Level 10

Hi Margaret,

I am not sure if you saw the example I uploaded onto the thread, but in any case here is an updated version.

Basically there are example of textfields with borders / underlines / fill colours, which change visually depending on user actions or printing. Hopefully you can following the differences between accessing the border properties and the fill properties. Once you are happy with this, it just depends on which event you put the script into.

On your form that you posted, I could see the green on the screen during as the prePrint event fired.

In the example I am uploading I have an example of a textfield with an underline. LC achieves an underline by applying a solid box and hiding three of the sides (top and both sides). Therefore when accessing the remaining side (the bottom of the box) you do not need to go through a loop, you can just access that one side.

I am probably not making myself clear on this. I think looking at the examples may help you.

The solutions are probably not the only way to achieve this effect, but it is the way that I have developed based on other people's solutions on the forum and blogs.

I hope that there are of help to you,

Niall 

Avatar

Level 7

Thank you. I will work with these scripts in the example.

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Level 7

These scripts are very helpful and it worked?

Thanks again for your help.

mdawn