setChoiceSelection

Stores one validated selection and publishes one revision. Returns false for a missing field or an invalid value. Programmatic writes, like setValue, may update read-only fields. A user transaction should use the overload with an expected field revision.


fun setChoiceSelection(fieldName: String, selection: PdfChoiceSelection, expectedRevision: Int): Boolean(source)

Commits only if the field has not changed since expectedRevision and remains visible and writable. The revision check and update share one lock, so a late script cannot replace a newer choice or one whose flags changed while the script ran. This overload can also restore the exact parsed source or default selection, including unresolved source values, when an editor cancels an edit. Arbitrary unresolved values remain invalid; user commits should first call PdfFormField.validateChoiceSelection.