This example would cause a browser to open 'a.pdf' and pop up an alert window AFTER setting a field value:<?phpheader('Content-type: application/vnd.fdf');$fdf = fdf_create();fdf_set_file($fdf, 'http://www.example.com/path/to/a.pdf');fdf_set_value($fdf, 'field1', 'my value');fdf_set_on_import_javascript($fdf, 'app.alert("executing javascript");', false);fdf_save($fdf);fdf_close($fdf);?>Or, to execute the javascript BEFORE setting the field value, just change false to true:<?phpheader('Content-type: application/vnd.fdf');$fdf = fdf_create();fdf_set_file($fdf, 'http://www.example.com/path/to/a.pdf');fdf_set_value($fdf, 'field1', 'my value');fdf_set_on_import_javascript($fdf, 'app.alert("executing javascript");', true);fdf_save($fdf);fdf_close($fdf);?>