[javascript bug] doc.setAction(cTrigger, '') does not clear the action (build 404)  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Mathew
User
Posts: 835
Joined: Thu Jun 19, 2014 7:30 pm

[javascript bug] doc.setAction(cTrigger, '') does not clear the action (build 404)

Post by Mathew »

It seems to be impossible to properly clear the action. Neither doc.setAction(cTrigger, null) nor doc.setAction(cTrigger, '') seem to properly clear it, although Document Properties > Actions shows the trigger cleared, there will still be a javascript warning when that action happens.

To reproduce:
Make a new document.
Run the following two lines in console:

Code: Select all

this.setAction('WillClose',"app.alert('annoy')");
this.setAction('WillClose','');
Confusingly, the action will show as "<Empty>" under document properties > Actions.
Make sure that Preferences > Javascript is set to alert for document javascript. Then close the document.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12927
Joined: Wed Jan 03, 2018 6:52 pm

Re: [javascript bug] doc.setAction(cTrigger, '') does not clear the action (build 404)

Post by Daniel - PDF-XChange »

Hello, Mathew

Thank you for the heads up, I have raised this with the Dev team for review!

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12927
Joined: Wed Jan 03, 2018 6:52 pm

Re: [javascript bug] doc.setAction(cTrigger, '') does not clear the action (build 404)  SOLVED

Post by Daniel - PDF-XChange »

Hello, Mathew

Here is the response from the dev team :D
This Editor's behavior is the same as Adobe's.
But in V11, the logic is changed, and now `setAction` with an empty string will remove the JS action instead of making an empty one.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]