Simple Date Entry for InfoPath

Had a request to enter in dates with a simple MMddYY format.  This is easier than you think.

  1. Create a for and add a Date Picker field to the view
  2. Double-click the field and add a new Rule
  3. Set the Condition as such: 
    1. string-length(.) = 6 and
    2. contains(“/”, .) = false and
    3. contains(“-“,.) = false
  4. Add an Action to Set a Fields Value
    1. Current Field or “.”
    2. Value: concat(substring(today(), 1, 2), substring(., 5, 2), “-“, substring(., 1, 2), “-“, substring(., 3, 2))
  5. Test out the for.  Enter a date like “050109” and it will put it in as 2009-05-01.

That is it.  Simple and easy to use

Advertisements