DatePicker validation issue - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

DatePicker validation issue

Last post 01-16-2011 03:59 AM by praveenbattula. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 03-10-2005 04:47 AM

    • amish
    • Not Ranked
    • Joined on 12-24-2004
    • India
    • Posts 19

    DatePicker validation issue

    Hi folks,

    Here is the Problem.

    I have a Date Control which needs to accept valid date from the user.I am validating date's using Regular expression.

    The following is the Regular expression used -> \d{4}-\d{1,2}-\d{1,2}
    The display format used is mm/dd/yyyy .

    It work fine in all scenarion's except for one scenario.
    When '02/31/2005' is entered, NO error message is displayed and
    Date is auto changed to '3/3/2005'.

    I even tried to validate this through custom script but before the scripting code is fired the '02/31/2005' input is changed to '3/3/2005' and the validation code Won't return any error since '3/3/2005' is a valid date.


    Is there any way we can validate for '02/31/2005' in Infopath either through use of RegEx or through any other means ?

    Is this a known bug with Infopath?



    Regards,
    Amish

    Amish
  • 03-10-2005 12:43 PM In reply to

    Re: DatePicker validation issue

    Hi Amish,

    Looks like you found a good bug in InfoPath. :)

    I sent e-mail to the InfoPath team, but my guess is that this is pretty low priority and it may make sense to process this way for other reasons (which I am unaware of).

    Good find!
    Patrick Halstead
    Project Manager at Qdabra
  • 03-10-2005 12:56 PM In reply to

    Re: DatePicker validation issue

    Microsoft responded:

    Cause there is no 2/31, ever? Really, cause it#%92s three days beyond the last date. You might see other behavior for 2/40. But specifically, we use Windows APIs to parse the dates, and 3/3/2005 is the value it returns when the user types in 2/31.

    Patrick Halstead
    Project Manager at Qdabra
  • 03-10-2005 01:04 PM In reply to

    Re: DatePicker validation issue

    More info from MS:

    A little more detail on how this is stored internally.

    The programming language stores the date as an integer relative to some arbitrary past date (something like January 1, 1976). The friendly representation is according to a serialization and deserialization scheme.

    The serialization schema is roughly (YYYY-1976)*366+MM*30+DD. I say roughly because it#%92s actually a more complicated case statement that takes varying month days into account and leap years in the February case.

    The deserialization is similar.

    So, when 2/31/2005 is serialized it#%92s actually something like 63351 (random number) which then gets deserialized to 3/3/2005.
    Patrick Halstead
    Project Manager at Qdabra
  • 03-10-2005 01:20 PM In reply to

    Re: DatePicker validation issue

    One more from MS (with feeling):

    You could probably make a case that this is a bug because there is no such thing as Feb 31 and we should parse this correctly before we serialize it. For example, if I meant to type 3/31, but typed 2/31 instead, I won#%92t get an error and will probably be surprised later when I get 3/3 instead of 3/31.
    Patrick Halstead
    Project Manager at Qdabra
  • 03-10-2005 05:33 PM In reply to

    Re: DatePicker validation issue

    Note: is the behavior of the Windows date parsing code (NLS), and the behavior will occur in many different applications.
    Patrick Halstead
    Project Manager at Qdabra
  • 03-12-2005 04:12 AM In reply to

    • amish
    • Not Ranked
    • Joined on 12-24-2004
    • India
    • Posts 19

    Re: DatePicker validation issue

    Hi Patrick,
    Thanks a lot for ur prompt reply.:-)))



    Amish
  • 04-01-2005 07:29 AM In reply to

    • Rip
    • Not Ranked
    • Joined on 02-04-2005
    • USA
    • Posts 20

    Re: DatePicker validation issue

    One of my InfoPath forms has a requirement for very robust and complete validation to include leap year checking and last date in month checking. From reading this thread it seems to me that instead of using the date picker control I will need to use a simple text box and do data validation using some pattern matching. Am I interpreting the information in this thread correctly? Thanks.



    Richard T. Henry
    Lewisberry, PA, USA
    riphenry@gmail.com
  • 04-04-2005 05:36 AM In reply to

    Re: DatePicker validation issue

    I would suggest using the Date picker control and having some onBeforeChange validator code.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
  • 08-11-2010 02:57 AM In reply to

    Re: DatePicker validation issue

     i used this for date validation -> \d{4}-\d{1,2}-\d{1,2}
    The display format used is mm/dd/yyyy .i too face same issue what faced I even tried to validate this through custom script but before the scripting code is fired the '02/31/2005' input is changed to '3/3/2005' and the validation code Won't return any error since '3/3/2005' is a valid date. did get any solution for this. if u get, please tell

     

  • 01-16-2011 03:59 AM In reply to

    Re: DatePicker validation issue

    Check this out! This may help someone. http://praveenbattula.blogspot.com/2011/01/date-validation-in-infopath-forms.html
    Filed under: ,
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.