0

This is my code :

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/js/validation/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="/js/validation/jquery.validationEngine.js"></script>

<script type='text/javascript'>
        $( document ).ready(function() {

            $(".register_form").validationEngine();

            $(".register_form").bind("jqv.field.result", function(event, field, errorFound, prompText){
                console.log(errorFound) ;
            });
        });
</script>

    <form id="contact-form" action ="<?php echo $this->basePath()."/user/register" ?>" method ="post"  name="register_form" class="register_form">
                    <div class ="col-md-6">
                        <div class="text-fields">
                            <div class="float-input">
                                <input name="username" id="username" type="text" class ="validate[required,custom[onlyLetterNumber],maxSize[20]] text-input"  placeholder="username"  >
                                <span><i class="fa fa-user"></i></span>
                            </div>
                        </div>
                     </div>
                    <button type="submit" name="contact-submit" id="register_submit">
                                <i class="fa fa-user"></i>
                                Register
                    </button>
    </form>

As you see i have just one input text field (username). but when i load the page in the console i get this error message : **

TypeError: $(...).validationEngine is not a function
$(".register_form").validationEngine();

**

WHY ? I already check multiple post from stackoverflow, which have related question, but non of them is working for me

4
  • Can you confirm by looking into the browser's console that there are no 404s while loading the relative references to the js files ? (hint- you might have to get rid of the leading / in the path) Commented Jan 3, 2015 at 14:53
  • 1
    it is not 404, im getting code, i believe there is some conflict with another version of jquery that i have , is there a way to keep all of the jquery version ?\ Commented Jan 3, 2015 at 14:57
  • 1
    Please dont do that. The code becomes unmaintainable. It is a better idea to do it the clean way. If you already have jquery loaded, why not use that? Just remove this reference of jquery - from the looks of it, jquery does not seem to be the issue - it is the validation libraries. Commented Jan 3, 2015 at 15:00
  • There demos have jquery version jquery-1.6.min.js... check if they are compatible with 1.11.2............... position-relative.net/creation/formValidator/js/… Commented Jan 3, 2015 at 15:01

2 Answers 2

2
<script type="text/javascript" src="/js/validation/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="/js/validation/jquery.validationEngine.js"></script>

I believe you shouldn't have those leading slashes at the beginning :

<script type="text/javascript" src="js/validation/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="js/validation/jquery.validationEngine.js"></script>

The path is thus wrong and the library not loaded. You then call a function/method that has not been defined.

Sign up to request clarification or add additional context in comments.

Comments

0

After some research I noticed this error only surfaces when validating radio buttons or checkboxes as follows:

<input id="level1" class="validate[required] radio" name="level" value="1" type="radio">
<input id="level2" class="validate[required] radio" name="level" value="2" type="radio">
<input id="level3" class="validate[required] radio" name="level" value="3" type="radio">

remove that or correct these to continue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.