{"id":11051,"date":"2019-11-14T14:18:18","date_gmt":"2019-11-14T14:18:18","guid":{"rendered":"https:\/\/verwoodtoday.co.uk\/?page_id=11051"},"modified":"2019-11-16T22:32:28","modified_gmt":"2019-11-16T22:32:28","slug":"register","status":"publish","type":"page","link":"https:\/\/martin.mx\/verwood\/register\/","title":{"rendered":"Register"},"content":{"rendered":"<p>We can send you local news and events direct to your inbox every Friday afternoon. Just enter your details below. We won&#8217;t use this information for anything else.<\/p>\n<form id=\"ema_signup_form\" target=\"_blank\" action=\"https:\/\/madmimi.com\/signups\/subscribe\/ae984a1188164834946ad4df50ad0d2f\" accept-charset=\"UTF-8\" method=\"post\">\n       <input name=\"utf8\" type=\"hidden\" value=\"\u2713\"\/><\/p>\n<div class=\"mimi_field required\">\n          <label for=\"signup_email\">Email*<\/label><input id=\"signup_email\" name=\"signup[email]\" type=\"text\" data-required-field=\"This field is required\" placeholder=\"you@example.com\"\/>\n       <\/div>\n<div class=\"mimi_field\">\n<p>         &nbsp;<br \/>\n <label for=\"signup_first_name\">First Name<\/label><input id=\"signup_first_name\" name=\"signup[first_name]\" type=\"text\" data-required-field=\"This field is required\"\/>\n       <\/div>\n<div class=\"mimi_field\">\n<p>          &nbsp;<br \/>\n<label for=\"signup_town\">Town you live in<\/label><input type=\"text\" name=\"signup[town]\" id=\"signup_town\" data-required-field=\"This field is required\"\/><br \/>\n          <input class=\"field_type\" type=\"hidden\" data-field-type=\"text_field\"\/>\n       <\/div>\n<p>      &nbsp;<\/p>\n<div class=\"mimi_field checkgroup required\" id=\"signup_audience_lists\">\n<div>\n<input class=\"checkbox\" id=\"list_7025033\" name=\"lists[]\" value=\"7025033\" type=\"checkbox\"\/><label for=\"list_7025033\">Verwood Updates<\/label>\n          <\/div>\n<p>          &nbsp;<\/p>\n<div>\n<input class=\"checkbox\" id=\"list_7041190\" name=\"lists[]\" value=\"7041190\" type=\"checkbox\"\/><label for=\"list_7041190\">Occasional emails from our friends<\/label>\n          <\/div><\/div>\n<div style=\"background: white; font-size:1px; height: 0; overflow: hidden\">\n          <input type=\"text\" name=\"51e233e6ea3d9724e60c5b60d86b64c7\" style=\"font-size: 1px; width: 1px !important; height:1px !important; border:0 !important; line-height: 1px !important; padding: 0 0; min-height:1px !important;\"\/><br \/>\n          <input class=\"checkbox\" type=\"checkbox\" name=\"beacon\"\/>\n       <\/div>\n<p>      &nbsp; <\/p>\n<div class=\"mimi_field\">\n          <input type=\"submit\" class=\"submit\" value=\"Subscribe\" id=\"webform_submit_button\" data-default-text=\"Subscribe\" data-submitting-text=\"Sending...\" data-invalid-text=\"\u2191 You forgot some required fields\" data-choose-list=\"\u2191 Choose a list\" data-thanks=\"Thank you!\"\/>\n       <\/div><\/form>\n<p><script type=\"text\/javascript\">\n(function(global) {\n  function serialize(form){if(!form||form.nodeName!==\"FORM\"){return }var i,j,q=[];for(i=form.elements.length-1;i>=0;i=i-1){if(form.elements[i].name===\"\"){continue}switch(form.elements[i].nodeName){case\"INPUT\":switch(form.elements[i].type){case\"text\":case\"hidden\":case\"password\":case\"button\":case\"reset\":case\"submit\":q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].value));break;case\"checkbox\":case\"radio\":if(form.elements[i].checked){q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].value))}break;case\"file\":break}break;case\"TEXTAREA\":q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].value));break;case\"SELECT\":switch(form.elements[i].type){case\"select-one\":q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].value));break;case\"select-multiple\":for(j=form.elements[i].options.length-1;j>=0;j=j-1){if(form.elements[i].options[j].selected){q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].options[j].value))}}break}break;case\"BUTTON\":switch(form.elements[i].type){case\"reset\":case\"submit\":case\"button\":q.push(form.elements[i].name+\"=\"+encodeURIComponent(form.elements[i].value));break}break}}return q.join(\"&\")};<\/p>\n<p>  function extend(destination, source) {\n    for (var prop in source) {\n      destination[prop] = source[prop];\n    }\n  }<\/p>\n<p>  if (!Mimi) var Mimi = {};\n  if (!Mimi.Signups) Mimi.Signups = {};<\/p>\n<p>  Mimi.Signups.EmbedValidation = function() {\n    this.initialize();<\/p>\n<p>    var _this = this;\n    if (document.addEventListener) {\n      this.form.addEventListener('submit', function(e){\n        _this.onFormSubmit(e);\n      });\n    } else {\n      this.form.attachEvent('onsubmit', function(e){\n        _this.onFormSubmit(e);\n      });\n    }\n  };<\/p>\n<p>  extend(Mimi.Signups.EmbedValidation.prototype, {\n    initialize: function() {\n      this.form         = document.getElementById('ema_signup_form');\n      this.submit       = document.getElementById('webform_submit_button');\n      this.callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random());\n      this.validEmail   = \/.+@.+\\..+\/\n    },<\/p>\n<p>    onFormSubmit: function(e) {\n      e.preventDefault();<\/p>\n<p>      this.validate();\n      if (this.isValid) {\n        this.submitForm();\n      } else {\n        this.revalidateOnChange();\n      }\n    },<\/p>\n<p>    validate: function() {\n      this.isValid = true;\n      this.emailValidation();\n      this.fieldAndListValidation();\n      this.updateFormAfterValidation();\n    },<\/p>\n<p>    emailValidation: function() {\n      var email = document.getElementById('signup_email');<\/p>\n<p>      if (this.validEmail.test(email.value)) {\n        this.removeTextFieldError(email);\n      } else {\n        this.textFieldError(email);\n        this.isValid = false;\n      }\n    },<\/p>\n<p>    fieldAndListValidation: function() {\n      var fields = this.form.querySelectorAll('.mimi_field.required');<\/p>\n<p>      for (var i = 0; i < fields.length; ++i) {\n        var field = fields[i],\n            type  = this.fieldType(field);\n        if (type === 'checkboxes' || type === 'radio_buttons' || type === 'age_check') {\n          this.checkboxAndRadioValidation(field);\n        } else {\n          this.textAndDropdownValidation(field, type);\n        }\n      }\n    },\n\n    fieldType: function(field) {\n      var type = field.querySelectorAll('.field_type');\n\n      if (type.length) {\n        return type[0].getAttribute('data-field-type');\n      } else if (field.className.indexOf('checkgroup') >= 0) {\n        return 'checkboxes';\n      } else {\n        return 'text_field';\n      }\n    },<\/p>\n<p>    checkboxAndRadioValidation: function(field) {\n      var inputs   = field.getElementsByTagName('input'),\n          selected = false;<\/p>\n<p>      for (var i = 0; i < inputs.length; ++i) {\n        var input = inputs[i];\n        if((input.type === 'checkbox' || input.type === 'radio') &#038;&#038; input.checked) {\n          selected = true;\n        }\n      }\n\n      if (selected) {\n        field.className = field.className.replace(\/ invalid\/g, '');\n      } else {\n        if (field.className.indexOf('invalid') === -1) {\n          field.className += ' invalid';\n        }\n\n        this.isValid = false;\n      }\n    },\n\n    textAndDropdownValidation: function(field, type) {\n      var inputs = field.getElementsByTagName('input');\n\n      for (var i = 0; i < inputs.length; ++i) {\n        var input = inputs[i];\n        if (input.name.indexOf('signup') >= 0) {\n          if (type === 'text_field') {\n            this.textValidation(input);\n          } else {\n            this.dropdownValidation(field, input);\n          }\n        }\n      }\n      this.htmlEmbedDropdownValidation(field);\n    },<\/p>\n<p>    textValidation: function(input) {\n      if (input.id === 'signup_email') return;<\/p>\n<p>      if (input.value) {\n        this.removeTextFieldError(input);\n      } else {\n        this.textFieldError(input);\n        this.isValid = false;\n      }\n    },<\/p>\n<p>    dropdownValidation: function(field, input) {\n      if (input.value) {\n        field.className = field.className.replace(\/ invalid\/g, '');\n      } else {\n        if (field.className.indexOf('invalid') === -1) field.className += ' invalid';\n        this.onSelectCallback(input);\n        this.isValid = false;\n      }\n    },<\/p>\n<p>    htmlEmbedDropdownValidation: function(field) {\n      var dropdowns = field.querySelectorAll('.mimi_html_dropdown');\n      var _this = this;<\/p>\n<p>      for (var i = 0; i < dropdowns.length; ++i) {\n        var dropdown = dropdowns[i];\n\n        if (dropdown.value) {\n          field.className = field.className.replace(\/ invalid\/g, '');\n        } else {\n          if (field.className.indexOf('invalid') === -1) field.className += ' invalid';\n          this.isValid = false;\n          dropdown.onchange = (function(){ _this.validate(); });\n        }\n      }\n    },\n\n    textFieldError: function(input) {\n      input.className   = 'required invalid';\n      input.placeholder = input.getAttribute('data-required-field');\n    },\n\n    removeTextFieldError: function(input) {\n      input.className   = 'required';\n      input.placeholder = '';\n    },\n\n    onSelectCallback: function(input) {\n      if (typeof Widget === 'undefined' || !Widget.BasicDropdown) return;\n\n      var dropdownEl = input.parentNode,\n          instances  = Widget.BasicDropdown.instances,\n          _this = this;\n\n      for (var i = 0; i < instances.length; ++i) {\n        var instance = instances[i];\n        if (instance.wrapperEl === dropdownEl) {\n          instance.onSelect = function(){ _this.validate() };\n        }\n      }\n    },\n\n    updateFormAfterValidation: function() {\n      this.form.className   = this.setFormClassName();\n      this.submit.value     = this.submitButtonText();\n      this.submit.disabled  = !this.isValid;\n      this.submit.className = this.isValid ? 'submit' : 'disabled';\n    },\n\n    setFormClassName: function() {\n      var name = this.form.className;\n\n      if (this.isValid) {\n        return name.replace(\/\\s?mimi_invalid\/, '');\n      } else {\n        if (name.indexOf('mimi_invalid') === -1) {\n          return name += ' mimi_invalid';\n        } else {\n          return name;\n        }\n      }\n    },\n\n    submitButtonText: function() {\n      var invalidFields = document.querySelectorAll('.invalid'),\n          text;\n\n      if (this.isValid || !invalidFields) {\n        text = this.submit.getAttribute('data-default-text');\n      } else {\n        if (invalidFields.length || invalidFields[0].className.indexOf('checkgroup') === -1) {\n          text = this.submit.getAttribute('data-invalid-text');\n        } else {\n          text = this.submit.getAttribute('data-choose-list');\n        }\n      }\n      return text;\n    },\n\n    submitForm: function() {\n      this.formSubmitting();\n\n      var _this = this;\n      window[this.callbackName] = function(response) {\n        delete window[this.callbackName];\n        document.body.removeChild(script);\n        _this.onSubmitCallback(response);\n      };\n\n      var script = document.createElement('script');\n      script.src = this.formUrl('json');\n      document.body.appendChild(script);\n    },\n\n    formUrl: function(format) {\n      var action  = this.form.action;\n      if (format === 'json') action += '.json';\n      return action + '?callback=' + this.callbackName + '&#038;' + serialize(this.form);\n    },\n\n    formSubmitting: function() {\n      this.form.className  += ' mimi_submitting';\n      this.submit.value     = this.submit.getAttribute('data-submitting-text');\n      this.submit.disabled  = true;\n      this.submit.className = 'disabled';\n    },\n\n    onSubmitCallback: function(response) {\n      if (response.success) {\n        this.onSubmitSuccess(response.result);\n      } else {\n        top.location.href = this.formUrl('html');\n      }\n    },\n\n    onSubmitSuccess: function(result) {\n      if (result.has_redirect) {\n        top.location.href = result.redirect;\n      } else if(result.single_opt_in || !result.confirmation_html) {\n        this.disableForm();\n        this.updateSubmitButtonText(this.submit.getAttribute('data-thanks'));\n      } else {\n        this.showConfirmationText(result.confirmation_html);\n      }\n    },\n\n    showConfirmationText: function(html) {\n      var fields = this.form.querySelectorAll('.mimi_field');\n\n      for (var i = 0; i < fields.length; ++i) {\n        fields[i].style['display'] = 'none';\n      }\n\n      (this.form.querySelectorAll('fieldset')[0] || this.form).innerHTML = html;\n    },\n\n    disableForm: function() {\n      var elements = this.form.elements;\n      for (var i = 0; i < elements.length; ++i) {\n        elements[i].disabled = true;\n      }\n    },\n\n    updateSubmitButtonText: function(text) {\n      this.submit.value = text;\n    },\n\n    revalidateOnChange: function() {\n      var fields = this.form.querySelectorAll(\".mimi_field.required\"),\n          _this = this;\n\n      var onTextFieldChange = function() {\n        if (this.getAttribute('name') === 'signup[email]') {\n          if (_this.validEmail.test(this.value)) _this.validate();\n        } else {\n          if (this.value.length === 1) _this.validate();\n        }\n      }\n\n      for (var i = 0; i < fields.length; ++i) {\n        var inputs = fields[i].getElementsByTagName('input');\n        for (var j = 0; j < inputs.length; ++j) {\n          if (this.fieldType(fields[i]) === 'text_field') {\n            inputs[j].onkeyup = onTextFieldChange;\n            inputs[j].onchange = onTextFieldChange; \n          } else {\n            inputs[j].onchange = function(){ _this.validate() };\n          }\n        }\n      }\n    }\n  });\n\n  if (document.addEventListener) {\n    document.addEventListener(\"DOMContentLoaded\", function() {\n      new Mimi.Signups.EmbedValidation();\n    });\n  }\n  else {\n    window.attachEvent('onload', function() {\n      new Mimi.Signups.EmbedValidation();\n    });\n  }\n})(this);\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We can send you local news and events direct to your inbox every Friday afternoon. Just enter your details below. We won&#8217;t use this information for anything else. Email* &nbsp; First Name &nbsp; Town you live in &nbsp; Verwood Updates &nbsp; Occasional emails from our friends &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-11051","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/pages\/11051"}],"collection":[{"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/comments?post=11051"}],"version-history":[{"count":10,"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/pages\/11051\/revisions"}],"predecessor-version":[{"id":11096,"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/pages\/11051\/revisions\/11096"}],"wp:attachment":[{"href":"https:\/\/martin.mx\/verwood\/wp-json\/wp\/v2\/media?parent=11051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}