Thanks so much, Maruan. It's too late now, but I'll surely give this a try tomorrow.
Gary -----Original Message----- From: Maruan Sahyoun [mailto:[email protected]] Sent: Sunday, May 28, 2017 3:40 PM To: [email protected] Subject: Re: PDFormFieldAdditionalActions.setC() not working? Hi, > Am 28.05.2017 um 20:04 schrieb Gary Grosso <[email protected]>: > > I'm hoping someone has done calculations or other actions as the result of a > textfield changing and can share their experience with me. you are missing to set the calculation order entry which is requiored if there are calculations. Add something like this: PDField field = acroform.getField("SampleField2"); COSArray calculationOrder = new COSArray(); calculationOrder.add(field); acroform.getCOSObject().setItem("CO", calculationOrder); BR Maruan > > Thanks, > Gary > > > -----Original Message----- > From: Gary Grosso [mailto:[email protected]] > Sent: Friday, May 26, 2017 6:12 AM > To: [email protected] > Subject: RE: PDFormFieldAdditionalActions.setC() not working? > > In general, I can execute JavaScript from > PDAnnotationAdditionalActions.setPO() to set the current date as a field > value, but I need to dynamically fill in some fields as the result of a > calculation using two or more other fields, and can't seem to do that. > Perhaps I'm going about it the wrong way? I can't seem to get anything at all > to fire as the result of a text field changing. > > -----Original Message----- > From: Gary Grosso [mailto:[email protected]] > Sent: Friday, May 26, 2017 12:19 AM > To: [email protected] > Subject: PDFormFieldAdditionalActions.setC() not working? > > In my project, I could not get setC to do anything, so I modified the > CreateSimpleForm.java code to create 2 fields (just in case that mattered), > which resulted in http://aapro.net/PDF/SimpleForm.pdf. > > Then I commented out a lot of distracting other event handling in > FieldTriggers.java, and duplicated everything to handle both fields, > resulting in http://aapro.net/PDF/FieldTriggers.java . This, when run gives > http://aapro.net/PDF/FieldTriggers.pdf, which, in PDFDebugger looks something > like this: > > AcroForm: (3) [3 0 R] > DA: /Helv o Tfo g > DR: (1) [70 R] > Fields: (2) > 0: (12) [SOR] /T:Annot /S:Widget > 1: (11) [60R] /T:Annot /S:Widget > AA: (2) [120 R] > C: (3) [19 O R] /T:Action > JS: app.alert("On 'recalculate' action") > S: Javascript > Type: Action > D: (3) [13 o R] /T:Action > JS: app.alert("On 'mouse down' action") > S: Javascript > Type: Action > > Whatever I do, much as in my original project, I never see "On 'recalculate' > action". > > I get the expected (if somewhat annoying) behavior for setK, setF, and setV. > Why not setC? > > Thanks, > Gary > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

