When changing form field value through API, JavaScript not fired

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

When changing form field value through API, JavaScript not fired

Post by stephen.starr »

Hello, I am using v319 of the SDK and I searched the forums but did not find anything related.

I have a form that has a field with a calculation JavaScript. If I programatically set the field value using SetValueText() the JavaScript is not fired. If I manually change the value in the form it is fired.

After calling SetValueText I am also calling InvalidatePages and FireFieldChangedEvent.

Do I need to do something special to get the JavaScript to fire?

Attached you will find the form (but note that the first field's label says hidden when it really isn't - ignore that). The JavaScript is on the first field.

Thank you,
Stephen
Attachments
NO PROMPT JAVASCRIPT TEST FORM.pdf
(344.62 KiB) Downloaded 88 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: When changing form field value through API, JavaScript not fired

Post by Sasha - Tracker Dev Team »

Hello Stephen,

You can use this JS to do what you need:

Code: Select all

this.getField("RX.UniqueID").value = "abs"
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: When changing form field value through API, JavaScript not fired

Post by stephen.starr »

Alex,

At first I misunderstood... but using the JavaScript to set the value rather than using the SetValueText method does seem to fire off the JavaScript I expect.

Thank you for your help,
Stephen
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: When changing form field value through API, JavaScript not fired

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply