cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eilishourigan
Helper II
Helper II

Date Picker - manually adding date in wrong format

I have a date picker field:

  • format is dd/mm/yyyy
  • it is not a mandatory field
  • it is part of a form that saves to a SharePoint List.

It works perfectly once the user selects the date from the date picker, however, if the user manually types in the date to the date picker text field (i.e. without selecting the date from the date picker), if the date is not in dd/mm/yyyy format no date is sent to SharePoint once the form is submitted.  No warning is given to the user to say this has happend.  

 

For example if I just type in 03/02/21 (instead of 03/02/2021) then when I submit the form the value is ignored.

I have tried to put a bit of code around this to put in some validation but I cannot access the value the user has typed in.  The SelectedDate value only populates if the date entered is in the correct format.

 

Is there anyway to add this validation - to make sure that a user types in the correct format

OR

Is there a way to force the user to pick the date from the date picker and not edit in the text field directly.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

Change the IsEditable Property of the DatePicker to false

That will force them to select

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
eka24
Super User III
Super User III

Change the IsEditable Property of the DatePicker to false

That will force them to select

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Suchitra1996
Resolver II
Resolver II

@eilishourigan 

 

I'm not sure if you can manually type a date in the date picker control within PowerApps. When you click to edit the date, it automatically opens the calendar to edit the date. 
May be you can try to insert a date picker in the data card separately in the form to validate this. 

I can manually type in the date to the date picker field alright - and no warning given if the format is incorrect - or no way to access the text programmatically if entered in the incorrect format.  @eka24 solution will do the job nicely - I will just take the option away from them 🙂

Kicking myself for not thinking of trying to change that setting 😄

 

 

That's perfect - a nice neat solution to the problem.  Thanks for your quick reply!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (99,041)