TwelvestoneBack End

PDF Form Javascript Question


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
Tha.Riddla
 
2009-08-04

Anyone know how to test and see if a checkbox is checked on a PDF form with Javascript? I need an if/else statement for producing a result if the box is checked or not.

TIABBQ!!

scudsucker
 
2009-08-04

As far as I know, this is not done with javascript? Is it not all internal to the PDF?

If you are sending the PDF by mail and expecting a response via mail, I've coded a little desktop flash app that converts the generated XML to a CSV... if you are keen to get the source let me know.

Tha.Riddla
 
2009-08-04

well, you can have form elements execute javascript internally in the PDF based on user actions - printing, saving, etc.

These are local use PDFs only. Basically I've got a form that grabs the current date from the system and fills in a text field when the user prints. I wanted to have the date be optional via the checkbox. Box is checked, print the date...box is unchecked, don't print the date.

Technomancer
 
2009-08-04

I did some automated-PDF scripts like that a few years back, so this maybe a little sketchy but try something like:

var doPrintDate = this.getField('printDate').value; if (doPrintDate != "Off") { //populate date field code here }

Tha.Riddla
 
2009-08-04

i figured it out...there were a few errors in my logic and syntax. This takes a value from a select box and populates the "NetWeight" fields as well as tests a checkbox for it's value and populates a set of date fields accordingly. There are multiple fields on the same page that need the same data, hence the for loop.

var i=0; var printMe = ""; var roastedDate = "Roasted on: " + util.printd("mm.dd.yy", new Date()); var noDate = " "; function checkCheckbox(){ if (this.getField("PrintRoastDate").isBoxChecked(0) == true) { printMe = roastedDate; } else { printMe = noDate; } return printMe; } checkCheckbox();

for (i = 1; i <= 3; i++) { this.getField("PrintDate"+i).value = printMe; this.getField("NetWeight"+i).value = this.getField("Weight").value; }

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneBack End

PDF Form Javascript Question