在我的项目中,我使用DocuSign PHP Client Library的Laravel包装器与e-sign REST API进行交互,以便预先填充DocuSign模板中的字段。
当您通过数组中至少两个键来设置值时,文本选项卡很有意义:
'textTabs' => [
[
'tabLabel' => '[DATA_LABEL]',
'value' => $this->model_attribute,
],
]然而,复选框让我不知所措,因为我尝试了完全相同的事情,但使用的是布尔值:
'checkboxTab' => [
[
'tabLabel' => '[DATA_LABEL]',
'value' => $this->model_attribute_thats_a_boolean, // true or false
],
]在查看我的文档时,无论值是多少,复选框都没有被勾选,所以我在基本PHP客户端库中做了一些研究。
这是指向checkboxTab的基础类的链接:
https://github.com/docusign/docusign-php-client/blob/master/src/Model/Checkbox.php
在1945行上有这样一个设置器:
/**
* Sets selected
* @param string $selected When set to **true**, the checkbox is selected.
* @return $this
*/
public function setSelected($selected)
{
$this->container['selected'] = $selected;
return $this;
}鉴于此,我假设您实际上不应该将value作为键传递,而应该将其作为selected传递,所以我尝试了以下方法:
'checkboxTab' => [
[
'tabLabel' => '[DATA_LABEL]',
'selected' => $this->model_attribute_thats_a_boolean, // true or false
],
]但是,即使这样也没有选中文档中相应的复选框,所以我有点困惑。
即使是this question似乎也认为我的思路是正确的。
发布于 2020-04-22 07:31:08
好吧,问题是它应该是真/假的字符串,而不是布尔值。您可以这样做:
'checkboxTab' => [
[
'tabLabel' => '[DATA_LABEL]',
'selected' => $this->model_attribute_thats_a_boolean ? 'true' : 'false'
],
]https://stackoverflow.com/questions/61340089
复制相似问题