DocuSign PHP SDK-如何以编程方式填充现有的文本选项卡? [英] DocuSign PHP SDK - How Do I Populate Existing Text Tabs Programmatically?

查看:42
本文介绍了DocuSign PHP SDK-如何以编程方式填充现有的文本选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用DocuSign PHP SDK,我想填写模板上现有文本标签/字段的值.

I am using the DocuSign PHP SDK and I would like to fill in values for existing text tabs / fields on my template.

我尝试使用以下内容:

$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 属性

where the parameter passed to setTabId() is taken from the tabId property of an object from the textTabs array in the template JSON export.

我也尝试使用

$textTab->setTabLabel('corresponding-label-id') 

代替

$textTab->setTabId()  

均未更改其引用的选项卡中的值.使用PHP SDK为现有的文本标签设置自定义值的正确语法是什么?

Neither changes the value in the tab they refer to. What's the correct syntax to set a custom value for an existing text tab using the PHP SDK?

推荐答案

请参阅示例您可以通过角色对象为签名者/收件人设置值.

You set the values via the role object for the signer/recipient.

例如

    # 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;

这篇关于DocuSign PHP SDK-如何以编程方式填充现有的文本选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆