Setting a field in a PDF Form using JavaScript

Hi There

I would like to set an existing PDF form field value depending on another form field value. E.g.
if the user who fills the form enters 20 in field A, then insert into field B the value 40 (2*A).

I would appreciate it, if someone has a short example.

FYI: I generate the PDF using QuickPDF and Delphi but this doesnt change anything in the answer I am looking for..

Thanks in advance!
skiaholicAsked:
Who is Participating?
 
skiaholicConnect With a Mentor Author Commented:
thanks for your answer but I tested the JavaScript code in Adobe LiveCycle Designer (ALC) and it didn't worked and neither with
the Delphi Library QuickPDF.

But what worked with ALC was to address the field directly with it's name
and to get the value using .rawValue.. like

fieldB.rawValue = fieldA.rawValue * 2;

but this didn't work with Delphi QuickPDF..

Maybe anyone has an idea why?
0
 
dr_linuxCommented:
Try this
var fieldA = this.getField("fieldA");
var fieldB = this.getField("fieldB");

fieldB.value = fieldA.value * 2;

Open in new window

0
 
dr_linuxCommented:
What does this mean that it doesn't work with Delphi QuickPDF?  I am unfamiliar with Delphi QuickPDF.. is that a PDF authoring tool sort of like ALC?  I'm guessing that when you try and use the javascript with Delphi QuickPDF the javascript is not working?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
skiaholicAuthor Commented:
Quick PDF is a library to modify and create PDF files and forms. The problem is, that I don't have access to their source code. Using adobe livecycle designer 8 the code I posted works.

That's why I am thinking that maybe there is a bug in quickPDF or they use different syntax, don't know..

Let's see if someone else has an idea otherwise I will accept my solution as the solution since it works with adobe livecycle designer..

Thank you!
0
 
dr_linuxCommented:
Yeah, I'm assuming that the javascript version isn't the same.  As in my first example, that was for and older PDF done in Acrobat version 7.
0
 
skiaholicAuthor Commented:
It is only partially correct since it works with livecycle designer but not with the QuickPDF library in delphi.

That's also why I only gave grade B.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.