PDF form field flags on iOS
Flags are sets of Boolean properties on an object. Each form field and form element in a document has flags that define behavior and capabilities. A form field tracks the entered data value. A form element is the visual object shown on a PDF page, and it’s represented by a widget annotation.
General field flags
The isReadOnly, isRequired, and isNoExport flags are available on all types of form fields: button fields, text fields, choice fields, and signature fields.
- If the
isReadOnlyflag istrue, then the UI won’t allow the form field to be filled or its value to be changed. You can also use theisEditableproperty on the form field as a transient property to disable user interaction. In other words,isReadOnlyis persisted in the PDF, whileisEditableisn’t. Note that the.readOnlyand.lockedContentsflags on the form element have no effect. - The
isRequiredflag is exposed but only partially supported. The elements of any fields marked as required will be displayed with a red border. However, Nutrient will allow form submission actions to run, even if some required form fields are empty. - The
isNoExportflag is exposed but not supported.
Button field flags
The isPushButton, isCheckBox, and isRadioButton properties can be used to read the type of a button field.
The NoToggleToOff and RadiosInUnison flags from the PDF reference aren’t exposed or supported.
Text field flags
The isMultiLine, isPassword, isComb, and doNotScroll flags are available to alter the behavior and appearance of text fields.
The isRichText, doNotSpellCheck, and fileSelect flags are exposed but not supported.
Choice field flags
The isCombo and isEdit properties can be used to read the type of a choice field:
- If both
isComboandisEditare enabled, then the field is a combo box, which allows picking from a list or entering custom text. In this case,isMultiSelectisn’t supported. - If only
isCombois enabled, then the field shows a dropdown list, without the option to enter custom text. In this case,isMultiSelectisn’t supported. - If
isComboisn’t enabled, then the field is a list box, which shows a list of options inline on the page. In this case, theisMultiSelectflag may be enabled, but theisEditflag is ignored.
The commitOnSelChange and doNotSpellCheck flags are exposed but not supported.
The Sort flag from the PDF reference isn’t exposed because the reference states that this flag isn’t intended to be used by PDF readers.
Form element flags
Since form elements are a type of widget annotation, you can access form element flags using the flags property inherited from Annotation. Therefore, the API for working with form element flags is mostly the same as the API for annotation flags. These can be used to make form elements hidden. See our annotation flags guide to learn more.
There are some exceptions for forms:
- Nutrient doesn’t provide any UI to edit form elements themselves, such as one for moving or resizing an element. Therefore, the
.lockedflag has no effect because there’s nothing to lock. - The
.readOnlyand.lockedContentsflags are ignored. Instead, to prevent a user from filling in a form, use theisReadOnlyproperty of the associated form field.