在Suitelet SS2.0上添加单选按钮

时间:2018-11-29 08:57:00

标签: netsuite suitescript suitescript2.0

我在Suitlet页面上添加了单选按钮,但是在加载页面时抛出错误。我不确定我要去哪里错了。

                        var custType1 = form.addField({
                            id: 'custpage_customertype',
                            name: 'retail_customer',
                            type: serverWidget.FieldType.RADIO,
                            label: 'Retail Customer',
                            container: 'companygroup'
                         });
                         var custType2 = form.addField({
                             id: 'custpage_customertype',
                             name: 'corporate_customer',
                             type: serverWidget.FieldType.RADIO,
                             label: 'Corporate Customer',
                             container: 'companygroup'
                         });
                         var custType3 = form.addField({
                             id: 'custpage_customertype',
                             name: 'external_customer',
                             type: serverWidget.FieldType.RADIO,
                             label: 'External Customer',
                             container: 'companygroup'
                         });    

在运行代码时,我在此行显示SSS_MISSING_REQD_ARGUMENT错误。以下是错误代码-

{“ type”:“ error.SuiteScriptError”,“ name”:“ SSS_MISSING_REQD_ARGUMENT”,“ message”:“ nlobjField:缺少必需的参数:radiobuttons:sSource”,“ stack”:[“ addField( N / serverWidget)“,”((/ SuiteScripts / sdr_sw_suitelet_test.js:123)“],”原因“:{”类型“:”内部错误“,”代码“:” SSS_MISSING_REQD_ARGUMENT“,”详细信息“:” nlobjField:丢失必需的参数:radiobuttons:sSource“,” userEvent“:null,” stackTrace“:[” addField(N / serverWidget)“,”(/(SuiteScripts / sdr_sw_suitelet_test.js:123)“],” notifyOff“:false}, “ id”:“”,“ notifyOff”:false,“ userFacing”:false}

1 个答案:

答案 0 :(得分:2)

您需要一个source属性,该属性将类似于单选按钮的ID。这将是脚本用来知道选择了哪个单选按钮的值。像

var custType1 = form.addField({
    id: 'custpage_customertype',
    name: 'retail_customer',
    type: serverWidget.FieldType.RADIO,
    label: 'Retail Customer',
    source:'retail',
    container: 'companygroup'
 });