DropDown: Change event fires twice

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

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

Jones
User
Posts: 7
Joined: Fri Nov 20, 2020 10:22 am

DropDown: Change event fires twice

Post by Jones »

Hi,
i'm developing dynamic forms with AEM Forms Designer (6.5.0.20190320.3.935878).
I noticed, that change events on dropdown lists fire twice when changing a value.
This doesn't happen in Acrobat.
Could you tell me, what's going wrong here?
And if possible, any idea on scripting to prevent this.[attachment=0]simpleDropdown.pdf[/attachment]

Attached is a simple pdf with only one dropdown list, where this happens.

regards
jones
You do not have the required permissions to view the files attached to this post.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: DropDown: Change event fires twice

Post by Tracker Supp-Stefan »

Hello Jones,

This is an XFA form - so I can't see the full JS besides that field in the Editor.
Please check if you can on your side when this event is set to file - and try to only fire it on e.g. the "willCommit" event. It should then only show up once.

And I will ask our devs to take a look in your sample.

Kind regards,
Stefan
Jones
User
Posts: 7
Joined: Fri Nov 20, 2020 10:22 am

Re: DropDown: Change event fires twice

Post by Jones »

Hi Stefan,
thanks for your quick reply.
The provided PDF was created from scratch. Just the drowdown list incl values added.
No other JS code than the app.alert(this.name + ": change event fires"); in the change event of
the dropdown list inside.
Unfortunately i need JS code inside change events in other dynamic forms.
E.g. users have to confirm the change, as this will change occurence of parts of the form and also
delete/change data.
So using events like willCommit isn't an option.

regards
jones
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: DropDown: Change event fires twice

Post by Tracker Supp-Stefan »

Hello Jones,

Thanks for the additional details!
I've asked a colleague from the dev team working on JS to take a look - and he has already confirmed he will do that.

In the mean time you can try to see if this works (as a workaround):

Code: Select all

if(event.willCommit){
  app.alert(this.name + ": change event fires"); 
}
This should make it so that this alert is only fired once.

Kind regards,
Stefan
Jones
User
Posts: 7
Joined: Fri Nov 20, 2020 10:22 am

Re: DropDown: Change event fires twice

Post by Jones »

Hi,

as far as i know, willCommit is a method/property of AcroForms.
As I'm working with AEM Forms Designer, this isn't available for me.
Please correct me, if I'm wrong.

regards
jones
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: DropDown: Change event fires twice

Post by Tracker Supp-Stefan »

Hello Jones,

It might indeed be different - XFA forms are quite more complex, and unfortunately the documentation for them is not public ('thanks' Adobe) - so our devs are kind of reverse engineering support for such XFA forms, but I myself have a much more limited access to what is available in them. I hope I will have some further feedback from our dev team for you shortly!

Kind regards,
Stefan