0

I'm using php-pdftk (https://github.com/mikehaertl/php-pdftk) to fill out the following fillable PDF form:

https://www.cigna.com/static/www-cigna-com/docs/health-care-providers/form-cms1500.pdf

In examining the fields, I see that there are several Button fields:

$pdf = new Pdf($pdf_template_path);
var_dump($pdf->getDataFields());

FieldType: Button
FieldName: insurance_type
FieldFlags: 0
FieldJustification: Left
FieldStateOption: Champva
FieldStateOption: Feca
FieldStateOption: Group
FieldStateOption: Medicaid
FieldStateOption: Medicare
FieldStateOption: Off
FieldStateOption: Other
FieldStateOption: Tricare

I should be able to select one of the FieldStateOptions, like "Medicare" when generating the PDF like this:

$fields = array(
     'insurance_type' => 'Medicare'
);
$result = $pdf->fillForm($fields)
                ->needAppearances()
                ->send();

But instead of selecting just Medicare, the form shows all boxes within insurance_type as checked. If I set the field value to "Off", all of the boxes are unchecked.

Any specific value fed to any Button field within this form seems to check all options within that field.

Is this an issue with the PDF template, how I am feeding the data, or maybe a bug with php-pdftk. Any help is greatly appreciated!

  • What PDF viewer do you use? This looks like an issue in PDF.js to me. – Jan Slabon Dec 08 '20 at 10:33
  • Thanks for the reply @JanSlabon. I was able to resolve by updating the PDF template itself (via Adobe Acrobat Pro). Inside the PDF file, each checkbox within a set had the same field name (eg. "insurance_type"). So when I was setting "insurance_type" to anything, all 7 checkboxes were checked. I updated the PDF to give a unique name to each checkbox, like "insurnace_type_medicare" so I can target them individually. – Steep Dev Dec 09 '20 at 03:50
  • Fields with the same name are absolutely fine, because they build a radio-button group then. Can you confirm that the issue was only in Firefox? I still belive that this is an issue of PDF.js. – Jan Slabon Dec 09 '20 at 09:51
  • @JanSlabon Just retested and you are right, the original radio button groups successfully accept individual item selection on Chrome but not Firefox. I never thought to check another browser - good call! At least I can use the workaround above to make it work more reliably for my purpose - thanks again. – Steep Dev Dec 10 '20 at 17:52
  • Issue is reported [here](https://github.com/mozilla/pdf.js/issues/12716) ;-) – Jan Slabon Dec 11 '20 at 08:36
  • Perfect, thank you. – Steep Dev Dec 12 '20 at 22:31

0 Answers0