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 / Default date displays ...
Power Apps
Unanswered

Default date displays in gallery edit/view mode instead of date entered

(0) ShareShare
ReportReport
Posted on by 10

When I select an entry from a gallery, I configured an edit and view button that takes you to the page where you originally entered the data. I set a variable, varFormData, to specify if the view is editable or not. The issue I’m running into is there is a date field. It displays correctly in the gallery, but if you view the date in either edit or view mode it defaults to today’s date which is a formula [Default = Today()]  I placed to ensure users don’t enter a date in the past on the original entry. Is there a workaround?

Categories:
I have the same question (0)
  • MissingLink Profile Picture
    236 on at

    Just so I understand you correctly

    If the form is in VIEW mode, then you want to see the date that the record was updated BUT

    if the form is in EDIT mode, then set the date=Today

     

    If that is what you want, then set the fields Default value = 

    If(YourFormName.FormMode='View', ThisItem.FieldName, Today())

     

    Does that work for you?

  • CU17121522-0 Profile Picture
    10 on at

    In both scenarios, when a form is in view or edit mode, I want to see the date that the user inputs so that they can verify or edit it from the gallery.

     

    Right now, the gallery shows the date the user inputs, but what I believe is happening is that when a user enters clicks the edit or view option that date field value is not being shown because the DataCard has a default of Today()  which was added to avoid users from accidentally entering a date in the past when they add data to begin the process. 

     

    So would I need to replace the Default of Today() in the form to avoid the error? If so, how do I ensure the default date isn't 1/1/1900 and users have to adjust day, month, and year?

  • MissingLink Profile Picture
    236 on at

    OK - So I presume that if there is already a date ion the field, then the user should NOT be able to edit it?

     

    If that's the case, then we change the DatePicker.Default =

    If(!IsBlank(ThisItem.DateFieldName), ThisItem.DateFieldName, Today()),

     

    And DatePicker.DisplayMode =

    If(EditForm(YourFormName) And !IsBlank(ThisItem.DateFieldName), 
    DisplayMode.Edit,
    DisplayMode.View)

     

    Then,  see Data Validation For Power Apps Forms - Matthew Devaney  which has a section called 'Validating the date reservation field'

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard