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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lock Date fields after...
Power Apps
Answered

Lock Date fields after user clicks on Save button

(0) ShareShare
ReportReport
Posted on by 652
Hello,
I have 2 date fields i.e. Requested Date and Requested Validated Date.
Within this app, I've also added a Gallery, so users can edit any of the available records.
 
Save button expression is set as:
SubmitForm(Form1);
And Edit Button expression is set as:
ResetForm(Form1);EditForm(Form1);
My requirement is - when Requested Date is entered and the form is saved - disable this date field, so next time when the users comes to edit this or any available record, they should not be able to edit this field.
 
Similarly when Requested Validated Date is entered and the form is saved - disable this date field, so next time when the users comes to edit this or any available record, they should not be able to edit this field.
 
Please advise.
Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    Set the Display Mode of the control accordingly.
     
    If(FormName.Mode = FormMode.Edit, DisplayMode.Disabled, DisplayMode.Edit)
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • Verified answer
    MVP-Phipps Profile Picture
    3,508 Super User 2024 Season 1 on at
    Rather than setting the DisplayMode property individually on each control, a more scalable approach is to set the Form Mode to View conditionally, based on whether the relevant date fields already have values.

    For example, you can set the Form1.DisplayMode property like this:
    If(
        !IsBlank(ThisItem.RequestedDate) && !IsBlank(ThisItem.RequestedValidatedDate),
        DisplayMode.View,
        DisplayMode.Edit
    )
    
    This way, if either of the date fields already has a value, the form will open in View mode, preventing edits to those fields. You can also tailor this logic further if you want to allow edits to other fields while locking just the date fields — but this approach avoids having to manage the display mode on each control individually.
     
    ; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-transform:none; word-spacing:0px">If this helps, please like. If this solves the problem, mark as a solution.cing: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> cing: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> ; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-transform:none; word-spacing:0px">Follow me on LinkedIn: https://www.linkedin.com/in/charlie-phipps-bennett-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
     
  • Prem4253 Profile Picture
    652 on at
     
    I tried with your logic. Applied the logic to both the date fields.
     
    And when I click the Edit button, both the date fields gets disabled even though we have not entered any dates.
     
     
    I'm giving a try with the logic provided by you. But please be informed I want to allow edits to other fields while locking just the date fields which has a date value
  • Verified answer
    MS.Ragavendar Profile Picture
    5,036 Super User 2025 Season 2 on at
     
    I understood in the edit mode it should not work, but seeing your comments in edit mode as well the value should not be blank 
     
    Try this out , it will work.
     
    If((FormName.Mode = FormMode.Edit && !IsBlank(ThisItem.RequestedDate) && !IsBlank(ThisItem.RequestedValidatedDate)), DisplayMode.Disabled, DisplayMode.Edit)
  • Prem4253 Profile Picture
    652 on at
     
    Thanks! to both of you. I applied both the logics and seems working as expected.
     
    Assuming when I save the form with the dates, it will be stored to SharePoint list without any errors.
  • MVP-Phipps Profile Picture
    3,508 Super User 2024 Season 1 on at
    @Prem4253 yes it will still patch to SharePoint, it just stops users from editing fields of the record for the condition applied.

    Do you want the entire form to be view only or some to be editable?
  • Prem4253 Profile Picture
    652 on at
     
    No, I do not want entire form to be disabled. Only the date fields which I mentioned.
     
    And this seems to be working. Thanks! once again for all your help.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard