This document explains why Bluebeam header fields behave the way they do, and how we control that behavior using JavaScript.
In Bluebeam (and Acrobat), a form field can exist in two fundamentally different ways:
This script intentionally uses the second approach:
ProjectName.0 ProjectName.1 ProjectName.2
Why?
Bluebeam does not have a built-in “max lines” setting. If a field is multiline, the user can normally:
We enforce a two-line limit using:
// Prevent typing or pasting more than 2 lines
function PB_limitLinesKeystroke(maxLines) {
var cur = String(event.value || "").replace(/\r\n/g, "\n");
var chg = String(event.change || "").replace(/\r\n/g, "\n");
var before = cur.substring(0, event.selStart);
var after = cur.substring(event.selEnd);
var proposed = before + chg + after;
if (proposed.split("\n").length > maxLines) {
event.rc = false;
}
}
// Final cleanup safeguard
function PB_enforceMaxLinesValidate(maxLines) {
var v = String(event.value || "").replace(/\r\n/g, "\n");
var lines = v.split("\n");
if (lines.length > maxLines) {
event.value = lines.slice(0, maxLines).join("\n");
}
}
f.multiline = true;
f.doNotScroll = true;
f.setAction("Keystroke", "PB_limitLinesKeystroke(2);");
f.setAction("Validate", "PB_enforceMaxLinesValidate(2);");
Result:
When the user edits:
ProjectName.0
We want:
ProjectName.1 ProjectName.2 ProjectName.3
to automatically match it.
function PB_syncHeaderField(baseName) {
var master = this.getField(baseName + ".0");
if (!master) return;
for (var p = 1; p < this.numPages; p++) {
var f = this.getField(baseName + "." + p);
if (f) f.value = master.value;
}
}
We attach it to the Validate event on page 0:
this.getField("ProjectName.0")
.setAction("Validate", "PB_syncHeaderField('ProjectName');");
That means:
If every page stayed editable:
function PB_setMirrorsReadonly(baseName) {
for (var p = 1; p < this.numPages; p++) {
var f = this.getField(baseName + "." + p);
if (f) f.readonly = true;
}
}
Because Bluebeam will treat them as one logical object. Page reordering and resizing can produce unpredictable results.
Character limits do not control line breaks. Two short lines can exceed one long line visually.
Paste, undo, and scripted changes bypass keystroke. Validate is the safety net.
This setup is deliberate, robust, and designed for real-world calculation packets.