summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-form.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-01 20:50:40 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-06-12 13:37:42 +0200
commit52bd350ee5ebed94416968714618d9604299f143 (patch)
tree5a0bd8f9f08796a3274b36606eb386cf4f1b1fa1 /source/pdf/pdf-form.c
parent473ecaee2c94aa04ef1a50ce853837e521f804b8 (diff)
downloadmupdf-52bd350ee5ebed94416968714618d9604299f143.tar.xz
Run both V and F additional actions when setting field values.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r--source/pdf/pdf-form.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index a8dc4062..96b8d652 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -716,19 +716,28 @@ int pdf_widget_type(fz_context *ctx, pdf_widget *widget)
static int set_text_field_value(fz_context *ctx, pdf_document *doc, pdf_obj *field, const char *text)
{
pdf_obj *v = pdf_dict_getp(ctx, field, "AA/V");
+ pdf_obj *f = pdf_dict_getp(ctx, field, "AA/F");
if (v && doc->js)
{
pdf_js_event e;
-
e.target = field;
e.value = fz_strdup(ctx, text);
pdf_js_setup_event(doc->js, &e);
execute_action(ctx, doc, field, v);
-
if (!pdf_js_get_event(doc->js)->rc)
return 0;
-
+ text = pdf_js_get_event(doc->js)->value;
+ }
+ if (f && doc->js)
+ {
+ pdf_js_event e;
+ e.target = field;
+ e.value = fz_strdup(ctx, text);
+ pdf_js_setup_event(doc->js, &e);
+ execute_action(ctx, doc, field, f);
+ if (!pdf_js_get_event(doc->js)->rc)
+ return 0;
text = pdf_js_get_event(doc->js)->value;
}