Skip to content

Commit

Permalink
Adding a fallback for when console object is not defined. This is to …
Browse files Browse the repository at this point in the history
…prevent the plug in breaking when being used in IE or browsers that do not support console.log
  • Loading branch information
rickycheers committed May 18, 2012
1 parent 5edcab8 commit ef4824b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
16 changes: 9 additions & 7 deletions formvalidator-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions formvalidator.js
@@ -1,7 +1,12 @@
var FormValidator = (function(jQuery){

var $ = jQuery;


console = console || {};
console.log = console.log || function(){};
console.info = console.info || function(){};
console.warn = console.warn || function(){};

/**
* A class that validates a HTML form.
*
Expand Down Expand Up @@ -136,7 +141,7 @@ var FormValidator = (function(jQuery){
var errorsInForm = 0;
for(var i = 0, length = this.form_inputs.length; i < length; i++) {
var input = this.form_inputs[i];
var value = input.value;
var value = $.trim(input.value);
var error_messages = validateInput.call(this, input, value);

//console.log('Input: ', input, 'has ' + error_messages.length + ' errors.');
Expand Down Expand Up @@ -299,13 +304,14 @@ var FormValidator = (function(jQuery){
'<input id="cvh" type="hidden" name="cvh" />' +
'<input id="captcha_value_value" type="text" name="captcha_value_value" />' +
'</div>';

$('#captcha').remove();
$('body').append(dialog_html);

$('#captcha').dialog({
autoOpen: false,
title: "Just to verify you are human.",
closeText: 'x',
width: "360px",
height: "250px",
buttons:{
Expand Down

0 comments on commit ef4824b

Please sign in to comment.