');
$("div.wpgform-captcha").show();
$.validator.addClassRules("wpgform-captcha", {
required: true,
});
}
// jQuery inline validation
$("div > .ss-item-required textarea").addClass("wpgform-required");
$("div > .ss-item-required input:not(.ss-q-other)").addClass("wpgform-required");
$("div > .ss-item-required textarea").addClass("wpgform-required");
$("div > .ss-item-required input:not(.ss-q-other)").addClass("wpgform-required");
$.validator.addClassRules("wpgform-required", { required: true });
$.validator.addMethod("regex", function(value, element, regexp) { var re = new RegExp(regexp); return this.optional(element) || re.test(value); }, "Please check your input.");
$("#ss-form").validate({
invalidHandler: function(event, validator) {
// 'this' refers to the form
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("div.error span").html(message);
$("div.error").show();
//$("div.error-message").show();
} else {
$("div.error").hide();
//$("div.error-message").hide();
}
},
//errorClass: "wpgform-error",
errorClass: "error-message",
rules: {
"wpgform-captcha": { equal: 0+8 }
},
messages: {
"wpgform-captcha": "Incorrect answer."
},
}) ;
// Fix checkboxes to work with Google Python
$("div.ss-form-container input:checkbox").each(function(index) {
this.name = this.name + '[]';
});
// Columnize the form
// Make sure we don't split labels and input fields
$("div.ss-item").addClass("wpgform-dontsplit");
// Wrap all of the form content in a DIV so it can be split
$("#ss-form").wrapInner("");
// Columnize the form content taking into account the new minwidth setting.
$(function(){
var width = $(window).width();
var minwidth = 0;
if (minwidth == 0 || width > minwidth) {
$(".wpgform-wrapper").columnize({
columns : 1,
columnFloat : "left",
cssClassPrefix : "wpgform"
});
// Wrap each column so it can styled easier
$(".wpgform-column").wrapInner("");
}
});
$("#ss-form").append("");
$("div.ss-form-container").after("");
// Change "Submit another response" URL to point to WordPress URL
// Changing the HREF attribute to an empty string results in the URL
// being the page the form is on.
$("a.ss-bottom-link").attr("href", "");
});