如何在Acrobat中将多个字段链接在一起,以便用户可以在当前字段已满时继续在下一个字段中写入?理想情况下,如果粘贴的字符串对于该字段而言过长,则将数据粘贴到一个字段中将继续粘贴到下一个字段中。
在此特定情况下,字段用于输入4位数组的IBAN号码,因为这是PDF表单字段下的纸质表单上使用的布局:
答案 0 :(得分:0)
虽然它并不完美,但您可以使用以下功能作为文档范围的功能。唯一的问题是,当粘贴跨越多个字段的文本时,光标当前没有移动到正确的字段。
Acrobat 9:高级>文档处理>文档JavaScripts
Acrobat 10:工具> JavaScript>文档JavaScript
function tab_chain(prev_field_name, next_fields) {
// Move to next field if the current keystroke
// fills the field. Move to the previous field
// if the current keystroke empties the field.
// Pasted data that is too long for the current
// will be continued into the fields listed in
// the next_fields array.
var rest, prev, next, i;
event.change = event.change.toUpperCase();
rest = event.changeEx.toUpperCase();
var merged = AFMergeChange(event);
//console.println("Name: '" + event.target.name + "'");
//console.println("Merged: '" + merged + "'");
if (merged.length === event.target.charLimit) {
//console.println("Limit: " + event.target.charLimit);
i = 0;
prev = event.target;
next = getField(next_fields[i++]);
rest = rest.substr(event.change.length);
while (next !== null && rest.length > 0) {
//console.println("Rest: " + rest);
merged = rest.substr(0, next.charLimit);
rest = rest.substr(merged.length);
next.value = merged;
prev = next;
next = getField(next_fields[i++]);
}
// Update focus if previous pasted field is full.
if (next !== null && merged.length === prev.charLimit) {
next.setFocus();
}
}
else if (merged.length === 0) {
getField(prev_field_name).setFocus();
}
}
然后,在 Properties>下将此函数称为自定义击键脚本。格式。作为第一个参数,您传递链中的前一个字段(如果是第一个字段,则为字段本身)。作为第二个参数,您传递链中以下字段的列表。例如,如果您的字段名为IBAN1,IBAN2,...,IBAN6:
IBAN1的脚本:tab_chain("IBAN1", ["IBAN2", "IBAN3", "IBAN4", "IBAN5", "IBAN6"]);
IBAN2的脚本:tab_chain("IBAN1", ["IBAN3", "IBAN4", "IBAN5", "IBAN6"]);
IBAN3的脚本:tab_chain("IBAN2", ["IBAN4", "IBAN5", "IBAN6"]);
等