解決済み
Reset all form fields to default value
Hello,
it is me again. 🙂
I am trying to reset a form when clicking a reset-button.
Currently i used the function resetForm(Fields) but i want to reset the fields to the default value which is given in the preferences/settings.
So i thought about looping all fields and put value to defaultValue but then my Acrobat freezes.
Previous Script:
var fieldstoteset = ["Field1", "Field2", "Field3"];
if(4==app.alert("The form will be resetted.\n\nAll data will be removed! Continue?",1,2)) {
this.resetForm(fieldstoteset );
this.getField("top").setFocus();
}New Try:
if(4==app.alert("The form will be resetted.\n\nAll data will be removed! Continue?",1,2)) {
for (var i = 0; i < this.numFields; i++) {
var fieldname = getField(getNthFieldName(i);
this.getField(fieldname).name).value = this.getField(fieldname).defaultValue;
}
this.getField("top").setFocus();
}
Many thanks in advance for your hints 🙂
