Fillable PDF(php-pdftk) Radio Buttons All or Nothing, Cannot Fill a Specific Value

496 views Asked by At

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!

0

There are 0 answers