3 Replies - 1952 Views - Last Post: 30 May 2012 - 07:00 AM

#1 Indrayani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-May 12

jquery date validation not working properly in IE9

Posted 30 May 2012 - 02:07 AM

In IE9 my jquery is not working properly. Actually the problem is when i enter the incomplete date in the textbox it should give an error popup showing invalid date ,but in IE9 the jquery takes the todays date by default and focuses to the next textbox without giving an error popup.

Please help me to resolve this question.. Thanks in advanced.

This post has been edited by Atli: 30 May 2012 - 02:19 AM
Reason for edit:: Moved to the jQuery forum. Please try to post your questions in the correct forums.

Is This A Good Question/Topic? 0
  • +

Replies To: jquery date validation not working properly in IE9

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: jquery date validation not working properly in IE9

Posted 30 May 2012 - 02:33 AM

We'll need to see the code that isn't working if we are to be of any help.
Was This Post Helpful? 0
  • +
  • -

#3 Indrayani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-May 12

Re: jquery date validation not working properly in IE9

Posted 30 May 2012 - 06:39 AM

This is the function which is validating the date.

function CheckValidDate(sInput) {
        var bReturn = false;
        var dates = sInput.split("/");
        var day = dates[1];
        var month = dates[0];
        var year = dates[2];
        var NewDay = daysInMonth(month, year);
        if (day > NewDay) {
            $('#<%=lblErrorMessage.ClientID %>').text('Please enter valid date.');
            $('#fade').show();
            $('#divError').show();
            $('#fade').unbind("click");
            $('#<%=btnErrOK.ClientID %>').focus();
            if ($('#<%=txtCtlrToFocus.ClientID %>').val() == "ValidDOB") {
                $('#<%=txtAge.ClientID %>').val("");
            }

            bReturn = false;
            return bReturn;
        }
        else if (day <= NewDay) {
            bReturn = true;
            return bReturn;
        }

    }


It is not working in IE9. Kindly go through it.

This post has been edited by Atli: 30 May 2012 - 06:53 AM
Reason for edit:: Please use [code] tags when posting code.

Was This Post Helpful? 0
  • +
  • -

#4 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: jquery date validation not working properly in IE9

Posted 30 May 2012 - 07:00 AM

OK. Just to figure out what's happening in that code, you need to do some debugging.

Lets make it simple. Right before the IF statement, add this line:
console.log(day + " > " + NewDay);


Then, in IE, press F12 and then open the page. In the dev tools that pop up, find the "Script" tab and check out what it says in the console.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1