locked
Date Picker Validation. RRS feed

  • Question

  • Hii there,,

    I am looking for a formula/code for validating the Date Picker control so that it cannot accept  any date that is more than one year(365 days) from Today or from a date that is specified on another Date Picker control. Anyone with an idea?

    Tuesday, February 28, 2012 8:51 AM

Answers

All replies

  • Hello,

    On the datepicker that you want to validate add a validation rule.  For the condition:

    datePickerField is greater than or equal to (select insert formula - see formula below):

    Insert a function > addDays.  For the first Insert Field, insert the "Today()" function.  For the second Insert Field type:  "365".  The formula should look like:

    addDays(Today(), "365")

    Then add your screentip.  Full condition will look like:

    datePickerField is greater than or equal to addDays(today(), "365)

    Melissa

    Tuesday, February 28, 2012 4:11 PM
  • Hi tegz07,

    There is no Validation Settings In SharePoint2007,it’s only in SharePoint2010.If use
    formula/code for validating the Date Picker control,   The correct syntax is:
    =
    datePickerField <TODAY()+365 or = datePickerField < datePickerField1+365

    Also you can validate a datePickerField use javascript, here is a link about it:
    http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/8954776e-6d83-4f98-bc35-e9745e3bac0e

    Examples of common formulas:
    http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA010105479.aspx


    Thanks,
    Lhan Han
    Friday, March 2, 2012 9:15 AM
    Moderator
  • Hi Lhan,

    That's true for SharePoint list / library columns.  However, this is an InfoPath forum so we should assume that tegz is questioning date picker validation within an InfoPath form.

    Thanks,

    Melissa

    Friday, March 2, 2012 1:17 PM