{"id":2965,"date":"2016-05-31T20:11:24","date_gmt":"2016-06-01T00:11:24","guid":{"rendered":"https:\/\/www.bu.edu\/scnc\/?page_id=2965"},"modified":"2016-06-23T16:40:33","modified_gmt":"2016-06-23T20:40:33","slug":"contact","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/scnc\/forms\/contact\/","title":{"rendered":"Secure Contact Form"},"content":{"rendered":"<p><script type=\"text\/javascript\">\r\n    \/\/ JSFormValidation.js\r\n    \/*\r\n     * Run init() after the page is loaded\r\n     *\/\r\n    window.onload = init;\r\n\r\n    \/*\r\n     * Initialization\r\n     *\/\r\n    function init() {\r\n        \/\/ Bind \"onsubmit\" event handler to the \"submit\" button\r\n        document.getElementById(\"scnc_form\").onsubmit = validateForm;\r\n        \/\/ Bind \"onclick\" event handler to \"reset\" button\r\n        document.getElementById(\"btnReset\").onclick = clearForm;\r\n        \/\/ Set initial focus\r\n        document.getElementById(\"first_name\").focus();\r\n    }\r\n\r\n    \/*\r\n     * The \"onsubmit\" event handler to validate the input fields.\r\n     *\r\n     * Most of the input validation functions take 3 arguments:\r\n     *   inputElm: Input element to be validated.\r\n     *   errMsg: the error message to be displayed if validation fails.\r\n     *   errElm: to place the error message\r\n     *\r\n     * @param theForm: the form to be validated\r\n     *\/\r\n    function validateForm(theForm) {\r\n        with(theForm) {\r\n            \/\/ return false would prevent default submission\r\n            return (isNotEmpty(first_name, \"Please enter your first name.\", elmfirst_nameError) \r\n\t\t\t&& isNotEmpty(last_name, \"Please enter your last name.\", elmlast_nameError) \r\n\t\t\t&& isValidEmail(email, \"Enter a valid email.\", elmemailError) && isNotEmpty(phone, \"Enter your phone number.\", elmphoneError) \r\n\t\t\t&& isNotEmpty(area_of_interest, \"Please enter your area of interest.\", elmarea_of_interestError) \r\n            );\r\n        }\r\n    }\r\n\r\n    \/*\r\n     * Helper function, to be called after validation, to show or clear\r\n     *   existing error message, and to set focus to the input element\r\n     *   for correcting error.\r\n     * If isValid is false, show the errMsg on errElm, and place the\r\n     *   focus on the inputElm for correcting the error.\r\n     * Else, clear previous errMsg on errElm, if any.\r\n     *\r\n     * @param isValid (boolean): flag indicating the result of validation\r\n     * @param errMsg (string)(optional): error message\r\n     * @param errElm (object)(optional): if isValid is false, show errMsg; else, clear.\r\n     * @param inputElm (object)(optional): set focus to this element,\r\n     *        if isValid is false\r\n     *\/\r\n    function postValidate(isValid, errMsg, errElm, inputElm) {\r\n        if (!isValid) {\r\n            \/\/ Show errMsg on errElm, if provided.\r\n            if (errElm !== undefined && errElm !== null && errMsg !== undefined && errMsg !== null) {\r\n                errElm.innerHTML = errMsg;\r\n            }\r\n            \/\/ Set focus on Input Element for correcting error, if provided.\r\n            if (inputElm !== undefined && inputElm !== null) {\r\n                inputElm.classList.add(\"errorBox\"); \/\/ Add class for styling\r\n                inputElm.focus();\r\n            }\r\n        } else {\r\n            \/\/ Clear previous error message on errElm, if provided.\r\n            if (errElm !== undefined && errElm !== null) {\r\n                errElm.innerHTML = \"\";\r\n            }\r\n            if (inputElm !== undefined && inputElm !== null) {\r\n                inputElm.classList.remove(\"errorBox\");\r\n            }\r\n        }\r\n    }\r\n\r\n    \/*\r\n     * Validate that input value is not empty.\r\n     *\r\n     * @param inputElm (object): input element\r\n     * @param errMsg (string): error message\r\n     * @param errElm (object): element to place error message\r\n     *\/\r\n    function isNotEmpty(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim() !== \"\");\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/* Validate that input value contains one or more digits *\/\r\n    function isNumeric(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim().match(\/^\\d+$\/) !== null);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/* Validate that input value contains only one or more letters *\/\r\n    function isAlphabetic(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim().match(\/^[a-zA-Z]+$\/) !== null);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/* Validate that input value contains one or more digits or letters *\/\r\n    function isAlphanumeric(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim().match(\/^[0-9a-zA-Z]+$\/) !== null);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/* Validate that input value length is between minLength and maxLength *\/\r\n    function isLengthMinMax(inputElm, minLength, maxLength, errMsg, errElm) {\r\n        var inputValue = inputElm.value.trim();\r\n        var isValid = (inputValue.length >= minLength) && (inputValue.length <= maxLength);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/\/ Validate that input value is a valid email address\r\n    function isValidEmail(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim().match(\r\n            \/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$\/) !== null);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/*\r\n     * Validate that a selection is made (not default of \"\") in <select> input\r\n     *\r\n     * @param selectElm (object): the <select> element\r\n     *\/\r\n    function isSelected(selectElm, errMsg, errElm) {\r\n        \/\/ You need to set the default value of <select>'s <option> to \"\".\r\n        var isValid = (selectElm.value !== \"\"); \/\/ value in selected <option>\r\n        postValidate(isValid, errMsg, errElm, selectElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/*\r\n     * Validate that one of the checkboxes or radio buttons is checked.\r\n     * Checkbox and radio are based on name attribute, not id.\r\n     *\r\n     * @param inputName (string): name attribute of the checkbox or radio\r\n     *\/\r\n    function isChecked(inputName, errMsg, errElm) {\r\n        var elms = document.getElementsByName(inputName);\r\n        var isChecked = false;\r\n        for (var i = 0; i < elms.length; ++i) {\r\n            if (elms[i].checked) {\r\n                isChecked = true;\r\n                break;\r\n            }\r\n        }\r\n        postValidate(isChecked, errMsg, errElm, null); \/\/ no focus element\r\n        return isChecked;\r\n    }\r\n\r\n    \/\/ Validate password, 6-8 characters of [a-zA-Z0-9_]\r\n    function isValidPassword(inputElm, errMsg, errElm) {\r\n        var isValid = (inputElm.value.trim().match(\/^\\w{6,8}$\/) !== null);\r\n        postValidate(isValid, errMsg, errElm, inputElm);\r\n        return isValid;\r\n    }\r\n\r\n    \/*\r\n     * The \"onclick\" handler for the \"reset\" button to clear the display,\r\n     * including the previous error messages and error box.\r\n     *\/\r\n    function clearForm() {\r\n        \/\/ Remove class \"errorBox\" from input elements\r\n        var elms = document.querySelectorAll('.errorBox'); \/\/ class\r\n        for (var i = 0; i < elms.length; i++) {\r\n            elms[i].classList.remove(\"errorBox\");\r\n        }\r\n\r\n        \/\/ Remove previous error messages\r\n        elms = document.querySelectorAll('[id$=\"Error\"]'); \/\/ id ends with Error\r\n        for (var i = 0; i < elms.length; i++) {\r\n            elms[i].innerHTML = \"\";\r\n        }\r\n\r\n        \/\/ Set initial focus\r\n        document.getElementById(\"first_name\").focus();\r\n    }\r\n\t\r\n\r\n<\/script><br \/>\n<noscript><\/p>\n<div class=\"noscriptmsg\"> You don&#8217;t have JavaScript enabled. Please <a href=\"http:\/\/www.bu.edu\/tech\/support\/browsers\/enable-cookies-and-javascript\/\">enable JavaScript<\/a> in your browser settings and try link again.<\/p>\n<style type=\"text\/css\">\n\t\t#scnc_form { display:none; }\n\t<\/style>\n<\/div>\n<p><\/noscript><\/p>\n<form action=\"https:\/\/ssl.datamotion.com\/form2.aspx\" method=\"post\" id=\"scnc_form\">\n  <input type=\"hidden\" name=\"txtto\" value=\"scnc@bu.edu\" \/><br \/>\n  <input type=\"hidden\" name=\"txtsubject\" value=\"SCNC Secure Contact Form\" \/><br \/>\n  <input type=\"hidden\" name=\"txtDone\" value=\"https:\/\/www.bu.edu\/scnc\/wp-assets\/contact\/thanks\/index.html\" \/><\/p>\n<p>Thank you for your interest in our services. Please provide your contact information and the nature of your request and one of our nutrition experts will contact you as soon as possible. <\/p>\n<fieldset>\n<legend class=\"secure-lock\">Contact Form<\/legend>\n<div>\n      <label for=\"first_name\">First Name: <em class=\"required\">*<\/em><\/label><br \/>\n      <input name=\"first_name\" id=\"first_name\" type=\"text\" \/>\n    <\/div>\n<div id=\"elmfirst_nameError\" class=\"errorMsg\">&nbsp;<\/div>\n<div>\n      <label for=\"last_name\">Last Name: <em class=\"required\">*<\/em><\/label><br \/>\n      <input name=\"last_name\" id=\"last_name\" type=\"text\" \/>\n    <\/div>\n<div id=\"elmlast_nameError\" class=\"errorMsg\">&nbsp;<\/div>\n<div>\n      <label for=\"email\">Email: <em class=\"required\">*<\/em><\/label><br \/>\n      <input name=\"email\" id=\"email\" type=\"text\" \/>\n    <\/div>\n<div id=\"elmemailError\" class=\"errorMsg\">&nbsp;<\/div>\n<div>\n      <label for=\"phone\">Phone: <em class=\"required\">*<\/em><\/label><br \/>\n      <input name=\"phone\" id=\"phone\" type=\"text\" \/>\n    <\/div>\n<div id=\"elmphoneError\" class=\"errorMsg\">&nbsp;<\/div>\n<div>\n      <label for=\"area_of_interest\">Area of Interest:<em class=\"required\">*<\/em><\/label><br \/>\n      <textarea id=\"area_of_interest\" name=\"area_of_interest\" cols=\"\" rows=\"\"><\/textarea>\n    <\/div>\n<div id=\"elmarea_of_interestError\" class=\"errorMsg\">&nbsp;<\/div>\n<div>\n      <input type=\"submit\" id=\"__btnSubmit\" name=\"__btnSubmit\" value=\"Submit\" onclick=\"redirect();\" \/><br \/>\n      <input type=\"reset\" id=\"__btnReset\" name=\"__btnReset\" value=\"Reset\" \/>\n    <\/div>\n<\/fieldset>\n<\/form>\n","protected":false},"excerpt":{"rendered":"<p>You don&#8217;t have JavaScript enabled. Please enable JavaScript in your browser settings and try link again. Thank you for your interest in our services. Please provide your contact information and the nature of your request and one of our nutrition experts will contact you as soon as possible. Contact Form First Name: * &nbsp; Last [&hellip;]<\/p>\n","protected":false},"author":1251,"featured_media":0,"parent":61,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/pages\/2965"}],"collection":[{"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/users\/1251"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/comments?post=2965"}],"version-history":[{"count":15,"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/pages\/2965\/revisions"}],"predecessor-version":[{"id":3564,"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/pages\/2965\/revisions\/3564"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/pages\/61"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/scnc\/wp-json\/wp\/v2\/media?parent=2965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}