Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4272046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:31:30+00:00 2026-05-21T07:31:30+00:00

I been looking at this for far too long here. I’m trying to use

  • 0

I been looking at this for far too long here. I’m trying to use two sets of validation on 2 fields (both dates, validation happens onblur, the default event for the validation engine).

The first set of validation happens all the time and verifies that the user has valid input dates.

The second set of validation happens only when both fields have correct dates. it preforms a check to verify both sets of dates have a valid date range to search for.

But its the second that I am currently having a problem with atm. My FuncCalls aren’t being recognized for some reason. I’ve looked at the documentation and the source but I am still not sure what exactly is the proper way of doing this or, for that matter ,in terms of dealing with interdependent fields, if there is a better way of handling this.

<html>
    <head>
        <script src="../../inc/functions.js" type="text/javascript"></script>
        <script src="../../inc/jquery-min.js" type="text/javascript"></script>
        <script src="../../inc/jquery.validationEngine.js" type="text/javascript"></script>
        <script src="../../inc/jquery.validationEngine-en.js" type="text/javascript"></script>
        <link href="../../inc/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript">

        //returns true if end is later than start
            function dateCompare(start, end) {
                if (isDate(start) && isDate(end)) {
                    return (new Date(start.toString()) < new Date(end.toString()))
                }
            }

            $(document).ready(function () {
                $("#arbitraryForm").validationEngine('attach');

                function rangeCheck(field, rules, i, options) {
                    alert("rangeCheck caLLEd");
                    var inDate1 = $("#inDate1").val();
                    var inDate2 = $("#inDate2").val();

                    if (!dateCompare(inDate1, inDate2)) {
                        return "arbitarty error";
                    }
                }

                $("#inDate1").blur(function (e) {
                    var inDate1 = PadDate($("#inDate1").val());
                    var inDate2 = PadDate($("#inDate2").val());
                    if (isDate(inDate1)) {
                        document.getElementById("inDate1").value = inDate1;
                        if (isDate(inDate2)) {
                            if (dateCompare(inDate1, inDate2)) {

                            }
                        }
                    }
                }),

                $("#inDate2").blur(function (e) {

                    var inDate2 = PadDate($("#inDate2").val());
                    if (isDate(inDate2)) {
                        document.getElementById("inDate2").value = inDate2;
                    }
                })
            });
        </script>
    </head>
    <form id="arbitraryForm" action="whatever_page.html">
        <div>
            <input type="text" id="inDate1" name="inDate1"  value="" class="validate[required,custom[dateFormat],funcCall[rangeCheck]]" /> 
            <input type="text" id="inDate2" name="inDate1"  value="" class="validate[required,custom[dateFormat],funcCall[rangeCheck]]" /> 
        </div>
            <input id="subbtn" type="submit" value="Run Report" name="subbtn"/>
    </form>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:31:30+00:00Added an answer on May 21, 2026 at 7:31 am

    I think you are adding complexity you don’t really need (this seems to happen a lot with jQuery). Why not just use something like:

            function rangeCheck() {
                alert("rangeCheck caLLEd");
                var inDate1 = $("#inDate1").val();
                var inDate2 = $("#inDate2").val();
    
                if (!dateCompare(inDate1, inDate2)) {
                    //flag the error in the form here, if you want
                    return false;
                }
                return true;
            }
    
            function blur1() {
                var inDate1 = PadDate($("#inDate1").val());
                var inDate2 = PadDate($("#inDate2").val());
                if (isDate(inDate1)) {
                    document.getElementById("inDate1").value = inDate1;
                    if (isDate(inDate2)) {
                        if (dateCompare(inDate1, inDate2)) {
    
                        }
                    }
                }
            }
    
            function blur2() {
                var inDate2 = PadDate($("#inDate2").val());
                if (isDate(inDate2)) {
                    document.getElementById("inDate2").value = inDate2;
                }
            }
    
    <form id="arbitraryForm" action="whatever_page.html" onSubmit="return rangeCheck();">
        <div>
            <input type="text" id="inDate1" name="inDate1"  value="" onBlur="blur1();" /> 
            <input type="text" id="inDate2" name="inDate1"  value="" onBlur="blur2();" /> 
        </div>
            <input id="subbtn" type="submit" value="Run Report" name="subbtn"/>
    </form>
    

    …it’s shorter, and more clear in what it is doing.

    Also, there’s no need to define your named function (rangeCheck() in this case) inside of the document.ready block. You can if you want, but if you do so you may want to explicitly assign it into the global scope, like so:

            window.rangeCheck = function(field, rules, i, options) {
                alert("rangeCheck caLLEd");
                var inDate1 = $("#inDate1").val();
                var inDate2 = $("#inDate2").val();
    
                if (!dateCompare(inDate1, inDate2)) {
                    return "arbitarty error";
                }
            };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be too opinionated a question, but looking for help! I have been
I've been looking for this information for my commercial desktop product, with no avail.
any help you can give is very gratefully accepted. I've been looking at this
I know this question has been asked a bit before. But looking around I
I have been looking into IKVMing Apache's FOP project to use with our .NET
I've been looking for a solution to this for a while now, have found
This has been an adventure. I started with the looping duplicate query located in
I´ve been looking for it yet in stackoverflow without success... Is it posible a
Have been looking at the MVC storefront and see that IQueryable is returned from
I've been looking for a decent guide to Haskell for some time, but haven't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.