I have a piece of Javascript that I'd like to only run when the user is viewing it in a browser window and NOT run when they are viewing it in Acrobat Reader. I'm using "if (event.target.external)" around the Javascript code, but it doesn't seem to be firing on the initialize event of the individual form field. Any help would be much appreciated.
this is an interesting task.
The solution (I found) is a bit tricky.
You need several things.
1. A form variable. To create one open "file > form properties > variables" and add a variable with the value "null".2. A script object with a function to readout the external property.
3. A hidden button to execute the script you need if the form is viewed in a browser. In my example it changes the value of a text field.
4. A script in the dox ready event of your form to trigger the hidden button.
Example:
[url]https://acrobat.com/#d=BgcbQhmR6CbeWZ2Ps9*ubw[/url]
By the way:
If you test the form from the preview in Designer, it will recognise an external viewer.
So you better save it first and then open it with Adobe Reader or a browser.
radzmar
• LoveCycle Blog
Documents you need:
• LiveCycle Designer ES2 Docs