Validation Rules for DatePicker Field - InfoPath Dev
in

InfoPath Dev

Validation Rules for DatePicker Field

Last post 10-25-2016 03:59 PM by Chris Horrocks. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-24-2016 08:16 AM

    Validation Rules for DatePicker Field

    Hi Everyone, I'm extremely new to Infopath and am hoping this is an easy fix. I currently have a Datepicker field (expected termination date), which has a validation rule dependent on the selection of a drop-down list earlier in the form. The validation seems to be working correctly (red asterisk only appears when validated when chosen conditions are met in prior field), however the validation requirement is not satisfied even once a date has been entered. After some research, I believe it may not be recognizing the date format. The Data type for the picker is currently "DateOnlyType". I've tried a variety of formats for the field, but with no success. Not sure if this is relevant to the problem, but the form has another Datepicker field with the same format and Data type, however has "Cannot be blank" validation rather than a validation rule, which is working correctly. Any help would be much appreciated. Thanks!
  • 10-24-2016 04:44 PM In reply to

    Re: Validation Rules for DatePicker Field

     XML dates are stored as yyyy-MM-dd, so, 2016-04-03, for example. What are you comparing your date to for validation? You can always attach a copy of the form under the Options tab in a reply & I'll take a look. :)

    Hilary Stoupa

  • 10-24-2016 04:59 PM In reply to

    Thanks Hilary. I've attached a copy of the template for some reference. I changed the date format for the field hoping this would fix the error, but unfortunately got the same result. My end-goal for this field is to be required when "Employee Type" is agency or temporary, but is not required for permanent.
  • 10-25-2016 07:48 AM In reply to

    I think you just need to add another condition to your validation rule to see if the date field is blank - see attached. Save the file locally, right click and select design to open in design mode, then preview. Since all you care about is if the date is blank, you shouldn't need to worry about the date formatting - but so you know in the future, all SharePoint dates are date time - no matter how the date field is formatted. You can drag the field onto your form and right click the date picker and change it to a text box, then set the formatting to show the XML value if you need to see the actual value of the field for a comparison. :)
    Hilary Stoupa

  • 10-25-2016 03:59 PM In reply to

    Re: Validation Rules for DatePicker Field

    Awesome, thanks Hilary! I added the condition to the validation rule and everything is now running correctly. Really appreciate the help.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.