Copy link to clipboard
Copied
I have a few forms that are fillable and are utilized in their digital format and as a printable copy to utilize while out in the field. Instead of having an underscore on the base document, is there a way to make the form field box act like the underline? So basically if the form field is blank underline the lower portion of the entire blank box, but if there is text only underline the portion of the box that contains text.
It's easier to implement on the print event, I think, although it's also possible to do it on the screen, but that might cause some delays in the file. If you want to try it out apply the following code as the custom Calculation script of any text field in the file:
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.type=="text") {
if (f.valueAsString=="") {
f.borderStyle = border.u;
f.lineWidth = 1
...
Copy link to clipboard
Copied
That's tricky, but it could be done by making the field "Rich Text", with an underline text property, and using a format script to display underlines when the field is empty.
Copy link to clipboard
Copied
You can do it by changing the field's stroke line style, but do you want this to only appear on the printed copy, or also on the screen?
Copy link to clipboard
Copied
I would like for it to appear on both, but if this is a monumental task on the printed copy would work as well.
Copy link to clipboard
Copied
It's easier to implement on the print event, I think, although it's also possible to do it on the screen, but that might cause some delays in the file. If you want to try it out apply the following code as the custom Calculation script of any text field in the file:
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.type=="text") {
if (f.valueAsString=="") {
f.borderStyle = border.u;
f.lineWidth = 1;
f.strokeColor = color.black;
} else {
f.borderStyle = border.s;
f.lineWidth = 0;
f.strokeColor = color.transparent;
}
}
}
Copy link to clipboard
Copied
that absolutely works! Is there a way to do this on multi line text boxes? So if I have a multi line text box that is 8 rows of text tall, is there a way to make it line the box for print and manual filling?
Copy link to clipboard
Copied
You mean underline each line? If so, then no.
Copy link to clipboard
Copied
Well you have been a big help thank you!
Copy link to clipboard
Copied
The multiline field would be handled with my first suggestion, Use rich text with an underline font.