ndh ndh - 7 months ago 31
HTML Question

How to change a field type in netsuite?

I am trying to create an online form using Netsuite.

We have a set for predefined fields like firstname, lastname, etc.

In the same we have a


tag but the field type by default is drop down with multiple select option.

How can I change this drop down to a checkbox?


If you use a custom template you can hide the drop-down and iterate its options to create your own checkboxes.


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

and then

        // convert multi select to checkbox
            var proto = this;
            var selName = $(proto).find("input").attr("name");
            var otherCB = null;
                var sel = $(this);
                var isReq = sel.hasClass('inputreq');
                if(isReq) sel.removeClass('inputreq');
                    if(!this.value) return;
                    var newby = $(proto.cloneNode(true));
                    var cb = newby.find("input").val(this.value);
                    if(isReq) cb.addClass('cb_selectone');
                            var otherField = $("input.otherShadow[name='"+ selName+"_other']").each(function(){
                                var newOther = this.cloneNode(true); // strange but it gets around an IE issue
                                $(newby).find("input").data("conditionalOther", 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