|
|
function extend(destination, source) for (var prop in source) destination[prop] = source[prop];
if (!Mimi) var Mimi = ; if (!Mimi.Signups) Mimi.Signups = ;
Mimi.Signups.EmbedValidation = function() this.initialize();
var _this = this; if (document.addEventListener) this.form.addEventListener('submit', function(e) _this.onFormSubmit(e); ); else this.form.attachEvent('onsubmit', function(e) _this.onFormSubmit(e); ); ;
extend(Mimi.Signups.EmbedValidation.prototype, initialize: function() this.form = document.getElementById('ema_signup_form'); this.submit = document.getElementById('webform_submit_button'); this.callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random()); this.validEmail = /[email protected]+\..+/ ,
onFormSubmit: function(e) e.preventDefault();
this.validate(); if (this.isValid) this.submitForm(); else this.revalidateOnChange(); ,
validate: function() this.isValid = true; this.emailValidation(); this.fieldAndListValidation(); this.updateFormAfterValidation(); ,
emailValidation: function() var email = document.getElementById('signup_email');
if (this.validEmail.test(email.value)) this.removeTextFieldError(email); else this.textFieldError(email); this.isValid = false; ,
fieldAndListValidation: function() var fields = this.form.querySelectorAll('.mimi_field.required');
for (var i = 0; i = 0) return 'checkboxes'; else return 'text_field'; ,
checkboxAndRadioValidation: function(field) var inputs = field.getElementsByTagName('input'), selected = false;
for (var i = 0; i = 0) if (type === 'text_field') this.textValidation(input); else this.dropdownValidation(field, input); this.htmlEmbedDropdownValidation(field); ,
textValidation: function(input) if (input.id === 'signup_email') return;
if (input.value) this.removeTextFieldError(input); else this.textFieldError(input); this.isValid = false; ,
dropdownValidation: function(field, input) if (input.value) field.className = field.className.replace(/ invalid/g, ''); else if (field.className.indexOf('invalid') === -1) field.className += ' invalid'; this.onSelectCallback(input); this.isValid = false; ,
htmlEmbedDropdownValidation: function(field) var dropdowns = field.querySelectorAll('.mimi_html_dropdown'); var _this = this;
for (var i = 0; i

Categories: None
The words you entered did not match the given text. Please try again.
Oops!
Oops, you forgot something.