Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Change a data card to read only when in Edit mode

Like (1) ShareShare
ReportReport
Posted on 19 Sep 2024 03:59:45 by 22
I am essentially asking a very similar question to what has been asked before "I am using PowerApps to create a SharePoint Form. I want to have a data card for "Date" that the user can change when they are submitting a new form, but if they click edit in the app, it becomes read only and they cannot change it anymore. Is this possible?"
 
However, the solution that was given a few years back gets flagged with an invalid argument error:
DisplayMode = "If(SharePointForm1.Mode = FormMode.New, DisplayMode.Edit.View)"
 
I then found and tried this, and while it doesn't get flagged with an error, it does not seem to be actually making any effect on the function of my form:
DisplayMode = "If(SharePointForm1.Mode = FormMode.New, DisplayMode.Edit, DisplayMode.View)"
 
Then, I found this answer in these forums, and it sort of works to lock the field when the form is in edit mode, but this includes having the DefaultDate set to "today."
DisplayMode = If(SharePointForm1.Mode=FormMode.New,DisplayMode.Edit,DisplayMode.View)
In short, when the form is edited, it shows todays date, rather than keeping/locking in the date that was entered when the form was first submitted, like I want.
 
Any suggestions would be much appreciated. I am at a loss as how to further troubleshoot this,
Karissa
  • LadieKay Profile Picture
    22 on 20 Sep 2024 at 23:40:09
    Change a data card to read only when in Edit mode
    Thank you so much Nandit!  That definitely did the trick, and I really appreciate your help!
    Ladiekay
  • Verified answer
    timl Profile Picture
    35,018 Super User 2025 Season 1 on 20 Sep 2024 at 14:38:20
    Change a data card to read only when in Edit mode
    Hi LadieKay,
     
    These sets of should hopefully accomplish what you want to achieve. 
     
     
    DefaultDate = If(SharePointForm1.Mode=FormMode.New,
                    Today(),
                    ThisItem.'Entry Date'
                  )
     
    DisplayMode = If(SharePointForm1.Mode=FormMode.New,
                    DisplayMode.Edit,
                    DisplayMode.View
                  )
     
     
  • Verified answer
    LadieKay Profile Picture
    22 on 19 Sep 2024 at 22:19:25
    Change a data card to read only when in Edit mode
    HI Nandit,
     
    I really appreciate your quick response! This might work, but I feel like adjustments would have to be made to the DefaultDate property code you suggest. This is because I already have a code in there that tells the form to autofill with "today's" date, so people don't have to enter it when they are filling out the form for the first time. However, I want this initial entry date to stay the same, so how do I keep the convenience for form users, while having it stay stable/uneditable in edit mode?
     
    DefaultDate = If(SharePointForm1.Mode=FormMode.New,DisplayMode.Edit,DisplayMode.
    ThisItem.'Entry Date')
     
    DisplayMode = If(SharePointForm1.Mode=FormMode.New,DisplayMode.Edit,DisplayMode.View)
     
     
    I am a novice at all this, learning this for work, so I am sorry if this seems like it should be obvious. I truly appreciate the hand holding,
    Ladiekay
  • Verified answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on 19 Sep 2024 at 10:16:19
    Change a data card to read only when in Edit mode
    Hi  LadieKay,
     
    How about you try to use the third formula you've mentioned:
    DisplayMode = If(SharePointForm1.Mode=FormMode.New,DisplayMode.Edit,DisplayMode.View)
    and update the DefaultDate property to:
    ThisItem.YourDateColumn
    Hope this helps. 
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard
Loading started
Loading started
Loading complete