[ 
https://issues.apache.org/jira/browse/PDFBOX-5113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293627#comment-17293627
 ] 

Michael Klink commented on PDFBOX-5113:
---------------------------------------

As the JavaScript is executed by the PDF viewer (if at all), it makes hardly 
sense to declare this a PDFBox bug.

Nonetheless, the event is specified as

{panel:title=Adobe Acrobat SDK JavaScript™ for Acrobat® API Reference}
h3. Field/Validate

Regardless of the field type, user interaction with a field may produce a new 
value for that field. After the user has either
clicked outside a field, tabbed to another field, or pressed the enter key, the 
user is said to have _committed_ the new data
value.

This event is the first event generated for a field after the value has been 
committed so that a JavaScript can verify that
the value entered was correct. If the validate event is successful, the next 
event triggered is the {{calculate}} event.

The {{target}} for this event is the field whose validation script is being 
executed. This event also defines the {{change}},
{{changeEx}}, {{keyDown}}, {{modifier}}, {{shift}}, {{targetName}}, and 
{{value}} properties.
{panel}

Thus, it sounds reasonable that this early in the event processing 
{{event.target.value}} still has the old value. Have you checked whether 
{{event.value}} holds the new value?

> Cannot retrieve new value on javascript by setv()
> -------------------------------------------------
>
>                 Key: PDFBOX-5113
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5113
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.22
>            Reporter: Henry Siu
>            Priority: Major
>
> I have tried the following code:
> PDFormFieldAdditionalActions a = new PDFormFieldAdditionalActions();
> a.setV(new PDActionJavaScript("app.alert(\{cMsg: event.target.value, nType: 
> 2, nIcon: 2});"));
> r.setActions(a);
> Which r is PDRadioButton.
> I find that event.target.value return the old value instead of the new value 
> after change. Is it any reason or is there any way to get the new value?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to