Skip to content

Kernel forms: a choice field is written with a value that is not one of its options #775

Backlog

Description

@Tim81

Why

ISO 32000-1, 12.7.4.4: when one item is selected, "V is a text string representing the name of the selected item, as given in the field dictionary's Opt array"; the default is null, "no item is currently selected". The Edit flag, the one case where V may be a typed value, is not set by the library.

Measured on origin/main b2791ba, no claim, Save of:

call written
AddChoiceField(page, "c", rect, ["x", "y"], "q") /Opt [(x) (y)] /V (q)
AddChoiceField(page, "c", rect, [], null) /Opt [] /V ()

Both save. BuildChoiceField takes the selected value as given, or the first option, or the empty string (AcroFormBuilder.cs), and the appearance draws it.

Sweep: AddChoiceField is the only writer of Opt and of a choice V; the other seven packages write no choice field.

Proposal

Refuse a selected value that is not one of options, at the call, with ArgumentException (ParamName selected), and write no V when there is no option to select (the default null). The 2.3.3 file was invalid, so the refusal is allowed. Document it on AddChoiceField.

Acceptance

  • The skipped test ConformanceAuditG6Tests.Iso32000_1_12_7_4_4_AChoiceValueIsAnItemOfTheOptionArrayOrAbsent runs and passes, and the pin Iso32000_1_12_7_4_4_PinsTodayAChoiceValueThatIsNotAnOptionIsWritten is replaced.
  • A choice field whose selected is an option, or null with options present, keeps its bytes.

Activity

  1. added
    bug
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions