跳到主要内容

AddOption

Adds options to checkbox group.

Syntax

expression.AddOption(nPage, aRect, sExportValue);

expression - A variable that represents a ApiCheckboxField class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPageRequirednumberpage to add option
aRectRequiredRectrect of new option
sExportValueOptionalstringoption checked value

Returns

ApiCheckboxWidget

Example

This example adds an option for checkbox field group.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let checkboxField = Api.CreateCheckboxField([10, 10, 25, 25]);
page.AddObject(checkboxField);

checkboxField.AddOption(0, [10, 30, 25, 45], 'Choice 2');
console.log('Toggle to off is: ' + checkboxField.IsToggleToOff());