web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Date Field Validation ...
Power Apps
Unanswered

Date Field Validation in SharePoint Custom Form (PowerApps)

(0) ShareShare
ReportReport
Posted on by 74

I noticed recently that when a user manually enters a date on a custom SharePoint form (which is a PowerApps app) that they can enter it incorrectly (e.g. 12-31-2001) and when they save the form it'll appear to save, but that column won't actually take the date and it'll be blank when the form is opened up the next time.

 

If I try to read the value the user entered from the date field (DateField.SelectedDate), then if it is formatted incorrectly, then I just get a blank value rather than a string, so I can't check it for improper formatting. It seems to be just correct or blank; nothing in-between. I don't want to prevent the from from saving if it returns blank because some of the date fields on my form are optional and in some cases, need to be left blank.

 

Does anyone else have a good setup for date validation on a PowerApps form?

Categories:
I have the same question (0)
  • EddieE Profile Picture
    4,643 Moderator on at

    @automan25 

    Sounds like you are using a DatePicker where the IsEditable is set to true, is this correct? If so, this setup may help:

     

    DatePicker Border Color

    // change colors to suit your requirements
    If( 
     IsMatch(Text(DatePicker1.SelectedDate, "mm/dd/yyyy"), "\d{2}\/\d{2}\/\d{4}"),
     RGBA(0, 18, 107, 1), 
     Color.Red 
    )

    Add a label beneath the DatePicker with these properties

    // Text property
    "Required date format: mm/dd/yyyy"
    
    // Visible property
    DatePicker1.BorderColor = Color.Red

     

    Looks like this in use

    EddieE_0-1699570211121.png

    You can then use the DisplayMode of your Submit/Save button to check for any red borders and set it to Disabled if there are any.

     

  • automan25 Profile Picture
    74 on at

    Thanks. This will help to inform the users when they are not using the correct date format. In my case though, since this isn't a required field, there are two correct inputs, blank or properly formatted. Thus, I need to be able to tell when either condition is present so I can prevent the form from being submitted when the date is improperly formatted.

  • EddieE Profile Picture
    4,643 Moderator on at

    @automan25 

    That's pretty simple to fix, just extend the logic to include Blanks. I think this will work:

    // change colors to suit your requirements
    If( 
     IsBlank(DatePicker1.SelectedDate) || 
     IsMatch(Text(DatePicker1.SelectedDate, "mm/dd/yyyy"), "\d{2}\/\d{2}\/\d{4}"),
     RGBA(0, 18, 107, 1), 
     Color.Red 
    )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 136 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard