我正在使用DocuSign PHP SDK,我想为模板上现有的文本标签/字段填写值。
我尝试使用以下内容:
$textTab = new \DocuSign\eSign\Model\Text();
$textTab->setTabId('f432a532-327e-4335-39ff-fk3285d732pd');
$textTab->setValue('3333 Kingman Ave');
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setTextTabs(array($textTab));
$templateRole->setTabs($tabs);
传递给setTabId()
的参数来自模板JSON导出中 textTabs 数组中对象的 tabId 属性。
我也尝试使用
$textTab->setTabLabel('corresponding-label-id')
代替
$textTab->setTabId()
都不会更改其引用的选项卡中的值。使用PHP SDK为现有的文本标签设置自定义值的正确语法是什么?
答案 0 :(得分:0)
请参见示例EG017SetTemplateTabValues.php
您可以通过角色对象为签名者/收件人设置值。
例如
# create the envelope definition with the template_id
$envelope_definition = new \DocuSign\eSign\Model\EnvelopeDefinition([
'status' => 'sent', 'template_id' => $args['template_id']
]);
# Set the values for the fields in the template
$check1 = new \DocuSign\eSign\Model\Checkbox([
'tab_label' => 'ckAuthorization', 'selected' => "true"]);
$number1 = new \DocuSign\eSign\Model\Number([
'tab_label' => "numbersOnly", 'value' => '54321']);
$radio_group = new \DocuSign\eSign\Model\RadioGroup(['group_name' => "radio1",
# You only need to provide the radio entry for the entry you're selecting
'radios' => [
new \DocuSign\eSign\Model\Radio(['value' => "white", 'selected' => "true"]),
]]);
$text = new \DocuSign\eSign\Model\Text([
'tab_label' => "text", 'value' => "Jabberwocky!"]);
# Pull together the existing tabs in a Tabs object:
$tabs = new \DocuSign\eSign\Model\Tabs([
'checkbox_tabs' => [$check1, $check3], 'number_tabs' => [$number1],
'radio_group_tabs' => [$radio_group], 'text_tabs' => [$text]]);
# Create the template role elements to connect the signer and cc recipients
# to the template
$signer = new \DocuSign\eSign\Model\TemplateRole([
'email' => $args['signer_email'], 'name' => $args['signer_name'],
'role_name' => 'signer',
'tabs' => $tabs # Set tab values
]);
# Create a cc template role.
$cc = new \DocuSign\eSign\Model\TemplateRole([
'email' => $args['cc_email'], 'name' => $args['cc_name'],
'role_name' => 'cc'
]);
# Add the TemplateRole objects to the envelope object
$envelope_definition->setTemplateRoles([$signer, $cc]);
return $envelope_definition;