I've gotten pretty good at configuring the mapping of PDF forms to Webforms with FillPDF, but one issue has me stumped. I've got a Webform "Select Options" component set to create radio buttons where you choose "Yes" or "No." The name (Field Key) of the component is "regular_job," and the options are simply:
1|Yes
0|No

On the PDF form, these are represented by checkboxes, for some reason, but they should work just the same. They are named "Employee_Doing_Regular_Job_YES" and "Employee_Doing_Regular_Job_NO."

In FillPDF, I have the PDF form field for the Yes checkbox "F[0].P3[0].Employee_Doing_Regular_Job_YES[0]" mapped to this FillPDF value: [webform:val-regular_job:keys:value:0] with no transformation.

I then have the No checkbox "F[0].P3[0].Employee_Doing_Regular_Job_NO[0]" mapped to the same [webform:val-regular_job:keys:value:0] with these transformation values:
0|1
1|0

On a completed form, if "Yes" is chosen, the Yes checkbox is filled in fine. If "No" is chosen, the field remains blank (as does the Yes box). Obviously this is a problem. On the same form, there are 4 other fields with the exact same Yes/No configuration, field mappings, and transformation values, and they all work fine. I've gone into the database and verified that the values are stored properly. If I change them so all 5 Yes/No checkbox pairs have a value of 1 in the database, they all show up as Yes on the filled-in PDF. If I set them all to zero, FillPDF fills them all in with No, except for this regular_job one, which stays empty.

I've opened the original PDF in LiveCycle to see what the settings are on that one checkbox, and they look the same as all the others, and verified there is only the one field with that ID label. I looked at all the checkbox pairs and all have an "On" value of 1 and "Off" value of 0, so matching up Yes and No should be trivial. I've verified there are no other fields mapped to that component, and I've made sure I don't have any stray spaces or new-line characters or anything else that might be messing up the mapping or transformation. I've tried the regular_job component with different levels of the [webform:val-regular_job] token array. I tried using just the one transformation of "0|1" for the No checkbox. And I've mapped the [webform:val-regular_job:keys:value:0] token to a plain text field to verify what it's putting out, and it always shows the correct value of zero or one.

So I'm pretty confident I have the mapping correct, FillPDF works, and Webform has stored the data properly. I think the only thing left is the PDF itself somehow being broken. Has anyone encountered this before where a PDf field with binary on/off values refuse to work? Or any situation where populating a particular field simply fails?

Comments

wizonesolutions’s picture

Hmm — uncertain if LiveCycle does this differently, but in Acrobat checkbox fields have an "Export Value", which is basically the value that makes the checkbox get checked. See if LiveCycle has that, and send exactly that value and check if it works.

The textbox test has shown us that some value is being output, but we aren't sure that it's the one that actually makes the checkbox work.

taquil’s picture

My Acrobat just wants to open the PDF in LiveCycle when I want to get under the hood. LiveCycle doesn't show anything labeled as "export value" but it has "on value" of 1 and "off value" of 0, default to "off." LiveCycle allows you to see the XML used to build the PDF, and this field looks no different from any of the other checkboxes on the form.

The only thing I find using the term "export" is something called "Import/Export Bindings" to do with connecting to a data source (such as a WSDL file) that isn't used.

I talked to the guy who originally created the PDF years ago, and he says he used LiveCycle to build it, and we couldn't find any difference between this field and any others. I deleted the checkbox and created a new one, just in case. But still no luck getting it to populate on a "no/0" value yet. It's probably something silly and obvious.

liam morland’s picture

Try manually running pdftk youfile.pdf dump_data_fields. It will output a list of the form components in your PDF. Look for the FieldStateOption values for the problem checkbox.

liam morland’s picture

This issue is about exposing the FieldStateOption values in the UI: #2143993: Improve handling of choice PDF form components

grimreaper’s picture

Hello,

Thanks Liam Morland for the command:

pdftk youfile.pdf dump_data_fields

It helps very much to understand the allowed values for checkboxes, radiobuttons. It should be added to the documentation.

wizonesolutions’s picture

Status: Active » Fixed

You're welcome to create a new "Troubleshooting" sub-page in the documentation https://drupal.org/documentation/modules/fillpdf. Documentation is wiki-style and can be edited by anyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.