Dynamic Stamp with auto Popup for data entry
Dear Adobe Community,
I’m trying to create a custom stamp that, when added to a document, automatically shows a popup dialog. This dialog should first ask the user (a) how many rows need to be filled, and then (b) display input fields for each row where the user can enter data separated by semicolons. These values are then parsed and placed into individual fields.
This works perfectly when I use the JavaScript in a regular PDF form. However, as soon as I turn it into a dynamic stamp, the input dialog no longer appears.
var maxRows = 5;
var zeilenStr = app.response({
cQuestion: "Wie viele Zeilen möchten Sie befüllen? (1–5)",
cTitle: "Zeilenanzahl eingeben",
cDefault: "3"
});
var anzahl = parseInt(zeilenStr);
if (isNaN(anzahl) || anzahl < 1 || anzahl > maxRows) {
app.alert("Ungültige Anzahl. Bitte zwischen 1 und 5 angeben.");
} else {
for (var i = 1; i <= anzahl; i++) {
var eingabe = app.response({
cQuestion: "Werte für Zeile " + i + " eingeben (mit Semikolon getrennt):\nMontant;Compte;Analytique;Type activite",
cTitle: "Zeile " + i,
cDefault: ""
});
if (eingabe) {
var werte = eingabe.split(";");
if (werte.length > 0) this.getField("MontantRow" + i).value = werte[0];
if (werte.length > 1) this.getField("CompteRow" + i).value = werte[1];
if (werte.length > 2) this.getField("AnalytiqueRow" + i).value = werte[2];
if (werte.length > 3) this.getField("Type activiteRow" + i).value = werte[3];
}
}
}
Thank you very much for your help!
Regards
Kremer
