Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JQUERY too much recursion

Status
Not open for further replies.

Swi

Programmer
Feb 4, 2002
1,963
US
I am getting this on one of my pages.

Looks like it is coming from my jquery-1.11.3.min.js file.

Swi
 
Ok, error is FF is: too much recursion
Error is Google Chrome is: Uncaught RangeError: Maximum call stack size exceeded.

Below is the only JQUERY I have on the form. Any ideas? Thanks.

Code:
<script>
  $(document).ready(function() {
    $("#mobile").mask("000-000-0000");
    $("#home").mask("000-000-0000");
    $('#password').bind("cut copy paste",function(e) {
        e.preventDefault();
    });
    $('#confirmpassword').bind("cut copy paste",function(e) {
        e.preventDefault();
    });
    $("#state").val("<%=state%>");
    $("#chkAll").click(function () {
        $(".check").prop('checked', $(this).prop('checked'));
    });
    $(".check").change(function(){
        if (!$(this).prop("checked")){
            $("#chkAll").prop("checked",false);
        }
    });
    $('#registered').formValidation({
      framework: 'bootstrap',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            firstname: {
                validators: {
                    notEmpty: {
                        message: 'First Name is required and cannot be empty'
                    },
                    stringLength: {
                        max: 30,
                        message: 'First name cannot be longer than 30 characters'
                    }
                }
            },
            lastname: {
                validators: {
                    notEmpty: {
                        message: 'Last Name is required and cannot be empty'
                    },
                    stringLength: {
                        max: 30,
                        message: 'Last name cannot be longer than 30 characters'
                    }
                }
            },
            city: {
                validators: {
                    notEmpty: {
                        message: 'City is required and cannot be empty'
                    },
                    stringLength: {
                        max: 30,
                        message: 'City cannot be longer than 30 characters'
                    }
                }
            },
            state: {
                validators: {
                    notEmpty: {
                        message: 'State is required and cannot be empty'
                    }
                }
            },
            zip: {
                validators: {
                    zipCode: {
                        country: 'US',
                        message: 'The zip is not valid US postal code'
                    },
                    notEmpty: {
                        message: 'Zip is required and cannot be empty'
                    },
                    stringLength: {
                        max: 10,
                        message: 'Zip cannot be longer than 10 characters'
                    }
                }
            },
            mobile: {
                validators: {
                    phone: {
                        country: 'US',
                        message: 'Mobile Phone is not valid US phone number'
                    },
                    notEmpty: {
                        message: 'Mobile Phone is required and cannot be empty'
                    },
                    stringLength: {
                        max: 12,
                        message: 'Mobile Phone cannot be longer than 12 characters'
                    }
                }
            },
            home: {
                validators: {
                    phone: {
                        country: 'US',
                        message: 'Home Phone is not valid US phone number'
                    },
                    stringLength: {
                        max: 12,
                        message: 'Home Phone cannot be longer than 12 characters'
                    }
                }
            },
            password: {
                validators: {
                    notEmpty: {
                        message: 'Password is required and cannot be empty'
                    },
                    stringLength: {
                        max: 16,
                        message: 'Password cannot be longer than 16 characters'
                    },
                    callback: {
                        message: 'The password is not valid',
                        callback: function(value, validator, $field) {
                            if (value === '') {
                                return true;
                            }

                            // Check the password strength
                            if (value.length < 8) {
                                return {
                                    valid: false,
                                    message: 'It must be more than 8 characters long'
                                };
                            }

                            // The password doesn't contain any uppercase character
                            if (value === value.toLowerCase()) {
                                return {
                                    valid: false,
                                    message: 'It must contain at least one upper case character'
                                }
                            }

                            // The password doesn't contain any uppercase character
                            if (value === value.toUpperCase()) {
                                return {
                                    valid: false,
                                    message: 'It must contain at least one lower case character'
                                }
                            }

                            // The password doesn't contain any digit
                            if (value.search(/[0-9]/) < 0) {
                                return {
                                    valid: false,
                                    message: 'It must contain at least one digit'
                                }
                            }

                            return true;
                        }
                    }
                }
            },
            confirmpassword: {
                validators: {
                    identical: {
                        field: 'password',
                        message: 'The password and the confirmation are not the same'
                    },
                    notEmpty: {
                        message: 'Confirm Password is required and cannot be empty'
                    },
                    stringLength: {
                        max: 16,
                        message: 'Confirm Password cannot be longer than 16 characters'
                    }
                }
            }
        }
    });
});
</script>

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top