<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFAnnotationButtonWidget/setOnStateValue(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFAnnotationButtonWidget(im)setOnStateValue:"
  },
  "title" : "setOnStateValue(_:)"
}
-->

# setOnStateValue(_:)

Sets the string that is associated with the on state of a radio button or checkbox control.

```
func setOnStateValue(_ name: String!)
```

## Discussion

Required for controls of types [`PDFAnnotationButtonWidget`](/documentation/PDFKit/PDFAnnotationButtonWidget) and [`PDFAnnotationButtonWidget`](/documentation/PDFKit/PDFAnnotationButtonWidget), the value of `name` describes the on state of the control (the off state is always labeled “Off”). Although “On” is an acceptable string for the on state of a single checkbox, a group of two or more radio buttons should have a unique string associated with each control.

For example, a form might display a group of 3 radio buttons that allow users to indicate an account type, such as savings, checking, or investment. The strings associated with the on states of these buttons could be “Savings,” “Checking,” and “Investment.” In this example, these 3 radio buttons also would share a field name string, such as “AccountType.”

## See Also

[`PDFAnnotationButtonWidget`](/documentation/PDFKit/PDFAnnotationButtonWidget)

A `PDFAnnotationButtonWidget` object provides user interactivity on a page of a PDF document. There are three types of buttons available: push button, radio button, and checkbox.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)