【问题标题】:How to change a field type in netsuite?如何更改netsuite中的字段类型?
【发布时间】:2016-08-17 22:42:04
【问题描述】:

我正在尝试使用 Netsuite 创建一个在线表单。

我们有一组预定义字段,例如名字、姓氏等。

同样我们有一个

NLSUBSCRIPTIONS

标签,但字段类型默认为下拉,带有多选选项。

如何将此下拉菜单更改为复选框?

【问题讨论】:

  • 这是什么类型的在线表格?这将有助于在哪里进行更改。

标签: javascript html netsuite


【解决方案1】:

如果您使用自定义模板,您可以隐藏下拉菜单并迭代其选项以创建您自己的复选框。

例如

    <div class="regFieldWrap">
        <span class='cbExpand hideNsLabel'><NLCUSTENTITY_LIST_FIELD></span><input class="otherShadow valid" type="text" name="custentity_list_field_other"><span class="multiProto cbHolder"><input type="radio" name="custentity_list_field"><label class="cbLabel"></label></span>
    </div>

然后

<script>
jQuery(function($){
        // convert multi select to checkbox
        $("span.multiProto").each(function(){
            var proto = this;
            var selName = $(proto).find("input").attr("name");
            var otherCB = null;
            $("select[name='"+selName+"']").css({display:'none'}).each(function(){
                var sel = $(this);
                var isReq = sel.hasClass('inputreq');
                if(isReq) sel.removeClass('inputreq');
                sel.find("option").each(function(){
                    if(!this.value) return;
                    var newby = $(proto.cloneNode(true));
                    var cb = newby.find("input").val(this.value);
                    if(isReq) cb.addClass('cb_selectone');
                    newby.find("label.cbLabel").text(this.text);
                    $(newby).removeClass('multiProto');
                    if((/\bother\b/i).test(this.text)){
                            var otherField = $("input.otherShadow[name='"+ selName+"_other']").each(function(){
                                var newOther = this.cloneNode(true); // strange but it gets around an IE issue
                                $(this).remove();
                                $(newby).find("input").data("conditionalOther", newOther);
                                newby.get(0).appendChild(newOther);
                            });
                            otherCB = newby;
                    } else proto.parentNode.insertBefore(newby.get(0), proto);
                });
                sel.get(0).options.length = 0;
            });
            if(otherCB) proto.parentNode.insertBefore(otherCB.get(0), proto); // make sure this is the end element
        });

});

【讨论】:

  • 非常感谢您的帮助。它真的会帮助我
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多