Date Validation - InfoPath Dev
in

InfoPath Dev

Date Validation

Last post 01-16-2011 10:25 PM by Jimmy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-05-2006 12:06 PM

    Date Validation

    I am creating a new employee set up form. We are requesting our managers to give us 3 days notice to get the setup complete. I was wondering if it would be possible to enable some sort of warning pop up if the manager selects a start date that is less than 3 days from the current day.

    Thanks in advance...

    Glenn
  • 06-05-2006 09:07 PM In reply to

    You will need code for that. Here is a VBScript sample code that calculates the difference between 2 date fields, named date1 and date2:

    Sub CTRL3_5_OnClick(eventObj)
    Dim nodeDate1
    Dim nodeDate2
    Dim dt1Val
    Dim dt2Val
    Dim daysElapsed

    Set nodeDate1 = XDocument.DOM.selectSingleNode("//my:myFields/my:date1")
    Set nodeDate2 = XDocument.DOM.selectSingleNode("//my:myFields/my:date2")

    dt1Val = CDate(nodeDate1.Text)
    dt2Val = CDate(nodeDate2.Text)

    daysElapsed = DateDiff("d", dt1Val, dt2Val)
    If daysElapsed < 3 Then
    Msgbox "Date #2 must be at least 3 days from the current day!"
    End If
    End Sub

    Stephanie Cantwell / Test Manager
    Qdabra® Software / Streamline data gathering to turn process into knowledge

  • 01-16-2011 04:36 AM In reply to

    This is what exactly you are looking for: http://praveenbattula.blogspot.com/2011/01/date-validation-in-infopath-forms.html
  • 01-16-2011 08:22 PM In reply to

    Praveen, this thread is 5 years old.

  • 01-16-2011 10:00 PM In reply to

    Still, people are looking for this. Can't I post? :)
  • 01-16-2011 10:15 PM In reply to

    If people are still looking for it, then post your reply where people are currently asking for it.  Yes, you can post, but it's not cool to dig up 5yo threads to post a link to your blog, especially with your 4th post.  I would have deleted it if it were a major violation, but instead I pointed out to you that it was a very old thread.

    It seems you created an account here just to post links to your blog even though your blog doesn't really answer the questions in these threads.  Your blog is very short and not very easy to read.  All you need to say in your blog is that rules only fire on a change to a field, so it of course makes no sense to put a rule on a field that doesn't change.  You always put the action rule on the field that is going to change, and then that change triggers the rest.  This is a basic, fundamental aspect of InfoPath rules.

  • 01-16-2011 10:25 PM In reply to

    Actually, all of Praveen's posts so far (except his response to you) have been links to his blog on very old threads.

     Praveen, if you're going to engage in shameless self-promotion, at least browse through some of the recent posts and provide some constructive help.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.