跳到主要内容

SetValue

设置复选框表单的状态。

语法

expression.SetValue(value);

expression - 表示 ApiCheckBoxForm 类的变量。

参数

名称必需/可选数据类型默认值描述
value必需boolean指定复选框是否选中(true)或未选中(false)。

返回值

boolean

示例

// The SetValue method accepts a boolean: true to check the box, false to uncheck it.

// Create a checkbox form and mark it as checked using SetValue.

let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"key": "Agreement", "tip": "I agree to the terms", "required": true, "placeholder": "Agreement"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" I agree to the terms");
checkBoxForm.SetValue(true);