<style>
form#thrivehive-form19552 {
color: #000000;
text-align: left;
font-size: 1.25em;
font-family: arial;
max-width: 50em;
}
form#thrivehive-form19552 span.required-star {
color: red;
}
form#thrivehive-form19552 textarea {
resize: vertical;
height: 3.65em;
}
form#thrivehive-form19552 li {
list-style-type: none;
}
form#thrivehive-form19552 input.hivesubmit {
color: white;
background-color: #28288f;
font-size: 1.25em;
font-weight: bold;
cursor: pointer;
padding: .5em .8em;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
border: none;
display: block;
clear: both;
}
/* Special settings for medium or large screen sizes. Note that min-width: 40.063em is the condition used in the
foundation grid for the start of medium screen size, so the condition here is set to match it exactly. */
@media only screen and (min-width: 40.063em) {
/* Float the submit button on the right, but not on small screen sizes, where it looks more natural on the left */
form#thrivehive-form19552 input.hivesubmit {
float: right;
}
/* Override the line items' left margin, which looks bad for checkboxes and radio options when to the right of the label
On small screens their are below the label, in which case it actually looks good with the margin. */
form#thrivehive-form19552 ul li.hiveform-responsive-option {
margin-left: 0px;
}
}
form#thrivehive-form19552 .error-block {
min-height: 1.6em;
clear: both;
color: #E10707;
}
</style>
<!-- Forms have the 'novalidate' attribute to disable HTML5 validation, since they have their own javascript-based validation -->
<form class="hiveform" action="//my.thrivehive.com/Webform/FormHandler" method="post" id="thrivehive-form19552" recaptchaenabled="true" novalidate>
<div class="row">
<div class="small-12 medium-3 columns">
<label for="form-field-1">Your Name <span class="required-star">*</span> </label>
</div>
<div class="small-12 medium-9 columns">
<input type="text" name="list.custom field - Your Name" id="form-field-1" required />
</div>
</div>
<div class="row">
<div class="small-12 columns">
<div id="form-field-1-errors" class="error-block"></div>
</div>
</div>
<div class="row">
<div class="small-12 medium-3 columns">
<label for="form-field-2">Referral&#39;s name <span class="required-star">*</span> </label>
</div>
<div class="small-12 medium-9 columns">
<input type="text" name="list.custom field - Referrals name" id="form-field-2" required />
</div>
</div>
<div class="row">
<div class="small-12 columns">
<div id="form-field-2-errors" class="error-block"></div>
</div>
</div>
<div class="row">
<div class="small-12 medium-3 columns">
<label for="form-field-3">Name of business <span class="required-star">*</span> </label>
</div>
<div class="small-12 medium-9 columns">
<input type="text" name="list.custom field - Name of business" id="form-field-3" required />
</div>
</div>
<div class="row">
<div class="small-12 columns">
<div id="form-field-3-errors" class="error-block"></div>
</div>
</div>
<div class="row">
<div class="small-12 medium-3 columns">
<label for="form-field-4">Phone <span class="required-star">*</span> </label>
</div>
<div class="small-12 medium-9 columns">
<input type="text" name="list.phone" id="form-field-4" required />
</div>
</div>
<div class="row">
<div class="small-12 columns">
<div id="form-field-4-errors" class="error-block"></div>
</div>
</div>
<div class="row">
<div class="small-12 medium-3 columns">
<label for="form-field-5">Email <span class="required-star">*</span> </label>
</div>
<div class="small-12 medium-9 columns">
<input type="text" name="list.email" id="form-field-5" required />
</div>
</div>
<div class="row">
<div class="small-12 columns">
<div id="form-field-5-errors" class="error-block"></div>
</div>
</div>
<div class="row">
<div class="small-12 columns">
<input type="hidden" name="meta.redirectUrl" id="meta_redirectUrl" value="http://www.seattlebenefitsconsulting.com/" />
<input type="submit" value="Submit" class="hivesubmit"/>
</div>
</div>
<div class="row">
<div class="small-12 columns">&nbsp;</div>
</div>
</form>
<script type="text/javascript">
var domreadyScriptUrl = (("https:" == document.location.protocol) ? "https://" : "http://") + "my.thrivehive.com/content/js/domready.js";
document.write(unescape("%3Cscript src%3D%27" + domreadyScriptUrl + "%27 type%3D'text/javascript'%3E%3C/script%3E"));
var validateScriptUrl = (("https:" == document.location.protocol) ? "https://" : "http://") + "my.thrivehive.com/content/js/validate.min.js";
document.write(unescape("%3Cscript src%3D%27" + validateScriptUrl + "%27 type%3D'text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
window.thValidateCurrentFormDomId = "thrivehive-form19552";
// The source code of th-validate.js, which expects the thValidateCurrentFormId global to be set
// It sets up a function for this form as a property of window.thValidate which we call below in the DomReady callback
(function() {
'use strict';
// NOTE: when searching using jQuery, always use $form.find(selector) rather than $(selector), since there
// may be several forms on the same web page.
window.thValidate = window.thValidate || {};
// Where we store the FormValidator objects, for convenience in debugging
window.thValidators = window.thValidators || {};
// To allow multiple forms on the same page, with potentially different versions of this javascript file embedded in them,
// we store the validation function inside an object, with the form element's id the key.
// NOTE: window.thValidateCurrentFormDomId must have been set before this script is executed.
window.thValidate[window.thValidateCurrentFormDomId] = setupFormValidation.bind(null, window.thValidateCurrentFormDomId);
function setupFormValidation(formDomId) {
var $ = jQuery,
$form = $("#" + formDomId),
$inputs = $form.find('input:not([type]),input[type="text"],textarea,select,input[type="checkbox"],input[type="radio"],input[type="email"]'),
validationRules = [],
alreadyProcessedInputs = [],
EMAIL_INPUT_NAME = "list.email";
// escapeHtml taken from mustache: https://github.com/janl/mustache.js/blob/ba510eb3549e5c7e673fd262e87f2a8027e03237/mustache.js#L47-L60
// We need this because labels can contain all sorts of special characters, include < and >, which need to be escaped to be used with innerHTML
var SPECIAL_CHARS = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};
function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return SPECIAL_CHARS[s];
});
}
$inputs.each(function(index, input) {
// Radio and checkbox inputs have several elements, but the validation is for the group as a whole,
// so if are on an element whose group we have already handled, we skip it.
var name = $(input).attr('name');
if (alreadyProcessedInputs.indexOf(name) !== -1) {
return;
} else {
alreadyProcessedInputs.push(name);
}
var rule = getRuleFor(input);
if (rule) {
validationRules.push(rule);
}
});
// Set up the validation using the validate.js library, http://rickharrison.github.io/validate.js/
window.thValidators[formDomId] = new window.FormValidator(formDomId, validationRules, updateValidationErrors);
return window.thValidators[formDomId];
// Auxiliary functions
function getRuleFor(input) {
var $input = $(input),
inputName = $input.attr('name'),
required = $input.attr('required');
var rules = [];
if (required) {
rules.push("required");
}
if (inputName === EMAIL_INPUT_NAME) {
rules.push("valid_email");
}
if (rules.length > 0) {
return {
name: inputName,
rules: rules.join("|"),
display: getDisplayName(input)
};
}
}
function getDisplayName(input) {
var $input = $(input),
inputType = $input.attr('type'),
isRadioOrCheckbox = inputType === 'radio' || inputType === 'checkbox';
return isRadioOrCheckbox ? getRadioOrCheckboxDisplayName(input) : getRegularInputDisplayName(input);
}
function getRadioOrCheckboxDisplayName(input) {
// For radio and checkbox fields, there are several inputs, each with a different id (DOM ids are unique).
// Because of that, they are given an attribute called 'data-field-id' storing the id for the field as a whole.
// (It is give either when a thrivehive form is generated or when an external form is instrumented.)
// This is useful here to find the label for the overall field.
var $input = $(input),
fieldId = $input.data('fieldId');
if (fieldId) {
var groupSelector = "#" + fieldId,
$label = $form.find(groupSelector + " .radio-or-checkbox-label");
if ($label.length > 0) {
return cleanedUpText($label);
}
}
// Otherwise, use a space, so the message is "The field is required"
return ' ';
}
function getRegularInputDisplayName(input) {
var $input = $(input),
inputId = input.id,
$label;
// First priority: if we have a label element for this input.
// This will be the case thrivehive forms
$label = $form.find('label[for="' + inputId + '"]');
if ($label.length > 0) {
return cleanedUpText($label);
}
// Second priority: if the input is inside a <label> element.
// This is never the case on thrivehive forms, but relatively common on forms in general
$label = $input.closest("label");
if ($label.length > 0) {
return cleanedUpText($label);
}
// Otherwise, use a space, so the message is "The field is required"
return ' ';
}
function cleanedUpText($element) {
// We want just the text directly in this element
var contents = $element.contents();
var text = "";
for (var i = 0, l = contents.length; i < l; i++) {
var child = contents[i];
if (child.nodeType === 3) {
text += child.nodeValue;
}
}
// Replace repeated whitespace with single space, then trim left and right
text = text.replace(/\s+/, ' ');
text = text.replace(/\s$/, '');
text = text.replace(/^\s/, '');
return text;
}
function updateValidationErrors(errors) {
// Clear any error messages from previous validation rounds
$form.find(".error-block").html('');
$.each(errors, function (i, error) {
// If we have no field name, reword the message slightly to make it better
// Note the 3 spaces between 'The' and 'field' (because the name is ' ', see above)
if (error.message === 'The field is required.') {
error.message = "This field is required.";
}
var fieldId = getFieldIdForInputElement(error.element),
errorBlockSelector = "#" + fieldId + "-errors",
message = escapeHtml(error.message);
$form.find(errorBlockSelector).html(message);
});
}
function getFieldIdForInputElement(elem) {
// elem is the element on which the error actually appears
// It can be either the input itself, or the input group in the case of radio/checkbox inputs with more than
// one option
var tagName = elem.tagName;
tagName = tagName && tagName.toLowerCase();
// <select> elements also have a positive length value, so we rule them out explicitly in the first if
if (elem.length && tagName !== 'select') {
// This is an input group (e.g. RadioNodeList). It doesn't have an id at all.
// Its children are the inputs, but they can't be given the id either, since there are several
// and elements' ids should be unique.
// So instead, the children have a 'data-field-id' attribute with the field's id, which we use here
var firstChild = elem[0];
return firstChild.getAttribute('data-field-id');
} else if (elem.getAttribute('data-field-id')) {
// This is the only radio/checkbox input in a one-option radio/checkbox field. Its id looks like
// form-field-3-1 (to cover the case where there are several), whereas the id for the field (used for
// displaying errors) is something like form-field-3. So we use the data-field-id attribute, which
// contains the right id for the field.
return elem.getAttribute('data-field-id');
} else {
// elem is the (non-radio-or-checkbox) input element itself, so we can just read off its id
return elem.id;
}
}
}
})();
DomReady.ready(function () {
// Avoid throwing an exception in the form preview pop-up due to $util not being available
if (window.$util) {
$util.SetFormHiddenID("CA-uid","thrivehive-form19552");
$util.SetFormSessionID("CA-sess","thrivehive-form19552");
$util.AddHiddenFieldInForm("meta.form-id","thrivehive-form19552","0d0c89a2-7874-4b22-8f54-a79c70c68c25");
$util.AddHiddenFieldInForm("meta.trackerid","thrivehive-form19552","f6876076ef044341b5782006d26f20a1");
}
window.thValidate["thrivehive-form19552"]();
}); // closing DomReady
</script>