2

現在のフィールドがいっぱいになったときにユーザーが次のフィールドに書き続けることができるように、Acrobat で複数のフィールドをリンクするにはどうすればよいですか? 理想的には、貼り付けられた文字列がそのフィールドには長すぎる場合、1 つのフィールドにデータを貼り付けると、次のフィールドにも引き続き貼り付けられます。

この特定のケースでは、フィールドは 4 桁のグループで IBAN 番号を入力するためのものです。これは、PDF フォーム フィールドの下にある紙のフォームで使用されるレイアウトであるためです。 IBAN フィールド

4

1 に答える 1

0

完全ではありませんが、次の関数をドキュメント全体の関数として使用できます。唯一の問題は、複数のフィールドにまたがるテキストを貼り付けるときに、カーソルが正しいフィールドに正確に移動しないことです。

Acrobat 9: Advanced > Document Processing > Document JavaScripts
Acrobat 10: Tools > JavaScript > Document 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();
    }
}

次に、この関数を[プロパティ] > [フォーマット]でカスタム キーストローク スクリプトとして呼び出します。最初のパラメーターとして、チェーン内の前のフィールド (最初の場合はフィールド自体) を渡します。2 番目のパラメーターとして、チェーン内の次のフィールドのリストを渡します。たとえば、フィールドの名前が IBAN1、IBAN2、...、IBAN6 の場合:

IBAN1 用スクリプト: tab_chain("IBAN1", ["IBAN2", "IBAN3", "IBAN4", "IBAN5", "IBAN6"]);
IBAN2 用スクリプト: IBAN3tab_chain("IBAN1", ["IBAN3", "IBAN4", "IBAN5", "IBAN6"]);
用スクリプト:tab_chain("IBAN2", ["IBAN4", "IBAN5", "IBAN6"]);
など

于 2014-07-29T12:20:51.957 に答える