Topic: Datepciker is not working with multiselect and select list.

gauravvijayvergia pro asked 6 years ago


Hi, I have a form which contains both datepicker and multiselect . At a time only 1 of them is working. If i remove datepicker then multiselect starts working and viceversa. Attach is the sample code
//some code here

        else
            if (obj.component == "select") {
                var selectList = document.createElement("select");
                selectList.id = obj.id;
                container.appendChild(selectList);

                for (var j = 0; j < obj.optionlist.length ; j++) {
                    var option = document.createElement("option");
                    option.value = obj.optionlist[j].Value;
                    option.text = obj.optionlist[j].Text;
                    selectList.appendChild(option);
                }

                $("#" + obj.id).material_select();
            }
            else if (obj.component == "multipleselect") {
                var selectList = document.createElement("select");
                selectList.id = obj.id;
                selectList.multiple = "multiple";
                container.appendChild(selectList);

                for (var j = 0; j < obj.optionlist.length ; j++) {
                    var option = document.createElement("option");
                    option.value = obj.optionlist[j].Value;
                    option.text = obj.optionlist[j].Text;
                    selectList.appendChild(option);
                }

                $("#" + obj.id).material_select();
            }
            else if (obj.component == "fileupload") {
                control = " <div class='file-field'><div class='btn btn-primary' id='fileupload'><span>Choose files</span> </div><div class='file-path-wrapper'><input class='file-path validate' type='text' placeholder='Upload one or more files'></div></div>";
                container.innerHTML += control;
                var divname = document.getElementById('fileupload');

                var input = document.createElement("input");
                input.type = "file";
                input.id = obj.id;

                if (obj.multiple == true) {
                    input.multiple = true;
                }

                if (obj.required == true) {
                    input.required = true;
                }
                divname.appendChild(input);
            }
            else if (obj.component == "datepicker") {
                control = " <div class='md-form' id='datepicker'></div>";
                container.innerHTML += control;
                var divname = document.getElementById("datepicker");

                var input = document.createElement("input");
                input.type = "text";
                input.id = obj.id;
                input.className = "form-control datepicker";
                input.placeholder = "Selected date";

                if (obj.required == true) {
                    input.required = true;
                }

                divname.appendChild(input);
                $("#" + obj.id).pickadate();
            }

//some code below

Michal Szymanski staff answered 6 years ago


Hi, I answered your email. Please send me all files of your project and I'll try to identify problem.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No