2

I'm making validator of textboxes in asp.net Web Forms. For example show error if value of textbox 5 is bigger than value of textbox 6. I tried to use validator engine from here:

http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

The thing is, when I try to reference to the engine in file Scripts, it doesn't load.

Here is script:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.validationEngine.js"></script>
<script src="~/Scripts/jquery.validationEngine-cz.js"></script>
<script>
    jQuery(document).ready(function () {
        jQuery("#ctl01").validationEngine();
    });
    /**
    *
    * @param {jqObject} the field where the validation applies
    * @param {Array[String]} validation rules for this field
    * @param {int} rule index
    * @param {Map} form options
    * @return an error string if validation failed
    */
</script>

and error here:

https://i.sstatic.net/ndVrO.jpg

Any ideas?

3
  • Replace ~/Scripts/jquery.validationEngine.js with Scripts/jquery.validationEngine.js Commented Apr 4, 2018 at 7:11
  • @AlexSlipknot this will make it search in the current folder use /Scripts/jquery.validationEngine.js instead for the root folder. Commented Apr 4, 2018 at 7:15
  • @Tarek.Eladly indeed. I thought he needs relative path Commented Apr 4, 2018 at 7:29

1 Answer 1

2

Just try this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validationEngine.js"></script>
<script src="/Scripts/jquery.validationEngine-cz.js"></script>
<script>
    jQuery(document).ready(function () {
        jQuery("#ctl01").validationEngine();
    });
    /**
    *
    * @param {jqObject} the field where the validation applies
    * @param {Array[String]} validation rules for this field
    * @param {int} rule index
    * @param {Map} form options
    * @return an error string if validation failed
    */
</script>

~ is used for relevant path so it is looking for the script in the wrong location.

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

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.