Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

auto fill form from web page content

seeggy
Level 1
Level 1

I need to fill a field in a PDF form (version 8 or newer) with a value provided by a web page.  The webpage is a counter to provide a unique, sequetial number.

I have been able to do this with Get() when using FormCalc, however I need more logic control than is provided in FormCalc.

I have attempted to implement the logic with JavaScript and getURL. When I open the form the JavaScript Console indicates: "TypeError: xfa.host.getURL is not a function"

Here is my code with some console diagnostics included:

console.println("formEmailed = " + xfa.form.topmostSubform.formEmailed.value);

if( xfa.form.topmostSubform.formEmailed.value == 1) {

  console.println("assignedTR = " + xfa.form.topmostSubform.assignedTR.value);

  if( !xfa.form.topmostSubform.assignedTR.value == 0){

    console.println("Getting URL...");

    xfa.host.getURL("http://somehost.com/index.html", true); //Get( "http://somehost.com/index.html");

    console.println("Field value = " + this.rawValue);

   // Verify a value actually got assigned

    if( this.rawValue.length > 0)

      xfa.form.topmostSubform.assignedTR.value = 1;

  } else {

    console.println("Not getting URL");

  }

}

Note: formEmailed and assignedTR are global variables.  The code is associated with the DocReady event.

I have been unable to locate any examples of filling a field in a from from a webpage.

Ultimately, I want the value from the webpage assigned to this.rawValue so that the value becomes part of the data in the form.

Suggestions?

0 Replies