locked
Default Dropdown to Current Month RRS feed

  • Question

  • Hi,

    In a dropdown I have input the months  January to December.
    How do I default to the current month when a new form is opened?
    Friday, May 8, 2009 1:39 PM

Answers

  • Well, you can do data validation that checks the current month and disallows any value below that #.  Or, if you change this into a data connection to a SharePoint list, then you can put all this in that list and do your filtering there before it gets to InfoPath.  There is a point at which using SharePoint list data connections becomes more simple than shoe-horning it into InfoPath logic statements.
    • Marked as answer by motionpotion Friday, May 8, 2009 11:18 PM
    Friday, May 8, 2009 8:47 PM

All replies

  • Hi,

    In a dropdown I have input the months  January to December.
    How do I default to the current month when a new form is opened?

    Set the values of those months to the numbers 1-12.  Have a hidden field somewhere that defaults to the function of "today()" with a substring command around it that extracts just the month value.  Make the dropdown default to the value in the "today" field.
    Friday, May 8, 2009 3:28 PM
  • Great.  Thanks Clayton.

    Also how would I prevent someone selecting a Month that has already passed this year?  Data Validation Rules?
    Friday, May 8, 2009 8:21 PM
  • Well, you can do data validation that checks the current month and disallows any value below that #.  Or, if you change this into a data connection to a SharePoint list, then you can put all this in that list and do your filtering there before it gets to InfoPath.  There is a point at which using SharePoint list data connections becomes more simple than shoe-horning it into InfoPath logic statements.
    • Marked as answer by motionpotion Friday, May 8, 2009 11:18 PM
    Friday, May 8, 2009 8:47 PM
  • Cool. I prefer not to shoehorn as I will probably only create support issues for myself in the future.
    I'll go the SharePoint List route.

    Thanks a lot for your help.
    Friday, May 8, 2009 9:51 PM
  • Worth marking as an answer?
    SharePoint Architect - Planet Technologies - 4-Year Microsoft Federal Partner of the Year (2005-2008)
    Friday, May 8, 2009 10:52 PM