Skip to content

check the checkboxes based on the export values when have same names #32

@satyajitnayk

Description

@satyajitnayk

Describe your idea

  • I have a checkbox.pdf with two check box groups.
  • check boxes in each group have same name but different export values.
  • How can I check checkbox based on their export value?

How could this be implemented?

  • I am able to find the check box with the export value, but no idea how to check it using it's widget reference!!
      if (field instanceof PDFCheckBox) {
          const widgets = field.acroField.getWidgets();
          for (const widget of widgets) {
            const exportValue = widget
              .getOnValue()
              ?.['encodedName'].replace(/^\//, '');
            console.log(exportValue, ' ==> ', widget.getAppearanceState());
            if (exportValue == value) {
              // widget.setAppearances();
              // check the check box using widget => no functionality available  in pdf-lib as of now it seems
              break;
            }
          }
      }
  • May be we need some method to check a checkbox using widget reference!

What problem are you trying to solve?

check the checkboxes based on the export values when all checkbox have same name.

Why does this matter to you?

  • We have a product that helps customer to fill fillable pdfs.
image
  • The requirement is customer wants to check checkbox 2 in first group & checkbox 1 in 2nd group. As all checkbox of first group have same names but different export values; same for 2nd group as well.

Would others find this helpful?

  • It's useful when filling a fillable pdf having checkbox group with same names & different export values.
  • Others will also find it useful.

Are you interested in implementing your proposal?

Yes

Why are you submitting a proposal?

shared in How could this be implemented?

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions