{"id":451,"date":"2023-10-02T17:28:33","date_gmt":"2023-10-02T21:28:33","guid":{"rendered":"https:\/\/vermontgeeks.com\/blog\/?page_id=451"},"modified":"2023-10-02T17:35:00","modified_gmt":"2023-10-02T21:35:00","slug":"test","status":"publish","type":"page","link":"http:\/\/vermontgeeks.com\/blog\/test\/","title":{"rendered":"testing only."},"content":{"rendered":"\n<script type=\"text\/javascript\" src=\"\/\/go.kaiserpermanente.org\/js\/forms2\/js\/forms2.min.js\"><\/script> <form id=\"mktoForm_1142\"><\/form> <script>MktoForms2.loadForm(\"\/\/go.kaiserpermanente.org\", \"492-NQU-014\", 1142);<\/script>\n<script type=\"text\/javascript\">\n(function(){\n\t\/* --- CONFIG SECTION - site-specific setup here --- *\/\n\t\/\/ array of <select multiple> fields & limits\n\t\/\/ minSelected & maxSelected are (obvs.) the range of elements that can be checked at once\n\tvar multipleSelects = [\n\t\t{\n\t\t\tfieldName: \"jobTitleSC\",\n\t\t\tminSelected: 1,\n\t\t\tmaxSelected: 4,\n\t\t\tminMessage: \"Choose 1 or 2 values!\",\n\t\t\tmaxMessage: \"Choose a maximum of 4 values!\",\n\t\t}\n\t];\n\n\t\/* --- NO NEED TO EDIT ANYTHING BELOW THIS LINE! --- *\/\n\n\tMktoForms2.whenReady(function (form) {\n\t\tvar formEl = form.getFormElem()[0],\n\t\t\tarrayify = getSelection.call.bind([].slice);\n\t\t\n\t\tvar\tselectIsPopup;\n\n\t\tmultipleSelects = multipleSelects.map(function (selectDesc) {\n\t\t\tselectDesc.selectEl = formEl.querySelector(\"[name='\" + selectDesc.fieldName + \"']\");\n\t\t\tselectDesc.nonEmptyOptions = arrayify(selectDesc.selectEl.options).filter(function (option) {\n\t\t\t\treturn option.value;\n\t\t\t});\n\n\t\t\tif( selectIsPopup === undefined ) {\n\t\t\t\t selectIsPopup = isSelectModePopup(selectDesc.selectEl);\n\t\t\t}\n\t\t\t\n\t\t\tif( selectIsPopup ){\n\t\t\t\tselectDesc.selectEl.remove(0);\n\t\t\t}\n\t\t\t\n\t\t\treturn selectDesc;\n\t\t});\n\t\t\n\t\t\/\/ in real-time, when the max selected is reached, disable remaining options in the group\n\t\tmultipleSelects.forEach(function (selectDesc) {\n\t\t\tselectDesc.selectEl.addEventListener(\"change\", function (e) {\n\t\t\t\tvar currentSelected = selectDesc.nonEmptyOptions.filter(isSelected),\n\t\t\t\t\tnumSelected = currentSelected.length;\n\n\t\t\t\tif (!selectIsPopup && numSelected == selectDesc.maxSelected) {\n\t\t\t\t\tselectDesc.nonEmptyOptions\n\t\t\t\t\t\t.filter(function (option) {\n\t\t\t\t\t\t\treturn currentSelected.indexOf(option) == -1;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.forEach(function (option) {\n\t\t\t\t\t\t\toption.disabled = true;\n\t\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tselectDesc.nonEmptyOptions.forEach(function (option) {\n\t\t\t\t\t\toption.disabled = false;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t\/\/ check minimum during validation\n\t\tform.onValidate(function (nativeValid) {\n\t\t\tif (!nativeValid) return;\n\n\t\t\tform.submittable(false);\n\n\t\t\tvar firstError;\n\t\t\tmultipleSelects.some(function (selectDesc) {\n\t\t\t\tvar currentSelected = selectDesc.nonEmptyOptions.filter(isSelected),\n\t\t\t\t\tnumSelected = currentSelected.length;\n\n\t\t\t\tif ( numSelected < selectDesc.minSelected || numSelected > selectDesc.maxSelected ) {\n\t\t\t\t\tfirstError = {\n\t\t\t\t\t\tdesc : selectDesc,\n\t\t\t\t\t\tmsg : numSelected < selectDesc.minSelected ? selectDesc.minMessage : selectDesc.maxMessage\n\t\t\t\t\t};\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (firstError) {\n\t\t\t\tform.showErrorMessage(\n\t\t\t\t\tfirstError.msg,\n\t\t\t\t\tMktoForms2.$(firstError.desc.selectEl)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tform.submittable(true);\n\t\t\t}\n\t\t});\n\t});\n\t\n  function isSelected(option) {\n\t  return option.selected;\n\t}\n\t\n  \/* Mobile touch devices like to use a popup-type widget for both <select> and <select multiple>, \n\t   and that widget will show the empty-valued \"Select...\" option as a peer w\/the other options in a \n\t\t confusing way. Desktop touch-capable devices don't have this problem, so just \"touch\" isn't enough. *\/\n\tfunction isSelectModePopup(sampleMultiSelect){\n\t\tvar isSelectModePopup;\t\t\n\t\t\n\t\t\/* if it's not touch-capable, don't worry about it *\/\n\t\tif ( !(\"ontouchstart\" in document) ){\n\t\t\t return false;\n\t\t}\n\n\t\t\/* inject a regular <select> and see if it's rendered the same as a multi *\/\n\t\tvar parentEl = sampleMultiSelect.parentNode,\n\t\t\t\ttestSingleSelect = sampleMultiSelect.cloneNode(true);\n\t\t\n\t\tvar multiHeight,\n\t\t\t\tsingleHeight;\n\t\t\n\t\t[\"id\",\"multiple\",\"size\"].forEach(function(removeableAttr){\n\t\t\ttestSingleSelect.removeAttribute(removeableAttr);\n\t\t});\n\t\t[[\"visibility\",\"hidden\"],[\"position\",\"absolute\"]].forEach(function(addableStyle){\n\t\t\ttestSingleSelect.style[addableStyle[0]] = addableStyle[1];\n\t\t});\n\t\tparentEl.insertBefore(testSingleSelect, sampleMultiSelect);\n\t\tmultiHeight = sampleMultiSelect.offsetHeight;\n\t\tsingleHeight = testSingleSelect.offsetHeight;\n\t\tparentEl.removeChild(testSingleSelect);\n\t\t\n\t\treturn multiHeight == singleHeight;\n\t}\n})();\n<\/script>\n<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-451","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/pages\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":3,"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/pages\/451\/revisions"}],"predecessor-version":[{"id":454,"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/pages\/451\/revisions\/454"}],"wp:attachment":[{"href":"http:\/\/vermontgeeks.com\/blog\/wp-json\/wp\/v2\/media?parent=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}