Skip to main content
Community site session details

Community site session details

Session Id : PKXR8ly/DRT0tmSpAwMm1z
Power Apps - Building Power Apps
Answered

How to make a Form Data Card edit only when in NewForm, and view when in EditForm

Like (0) ShareShare
ReportReport
Posted on 17 Mar 2022 10:33:23 by 87

Good morning Power Apps Community,

I would love some help to resolve an obstacle in my build.

 

In my form I have a field that relies on another field. Both of which are dropdowns. I'm trying to lock the first field to say "XYZ" and not show other options. However this has proved rather difficult. 

 

In my app I have 

1. A gallery only showing items that are affected by "XYZ"

2. A Form that toggles to NewForm & EditForm

 

In the Editform mode, the field shows "XYZ" because it's showing data already in the gallery. However with NewForm it's left blank so I can not use view mode on the data card.

 

One method of partially tackling this would maybe be to use display forms to only allow editing in when newform, and leave it as view only when in Editform. Is this possible?

Code I have so far, which is not working:

If(NewForm(Gallery_ABC) ,DisplayMode.Edit,DisplayMode.View)

 

Any solutions to this problem would be amazing! Thank you so much for your time 😄

Categories:
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 18 Mar 2022 at 09:14:28
    Re: How to make a Form Data Card edit only when in NewForm, and view when in EditForm

    Hi @PowerAppsRookie,

    Do you want to make the data card read-only in new mode?

    Could you please share a bit more about your scenario?

     

    Actually, you could set the Default or DefaultSelectedItems property of the dropdown control as below:

    If(Form2.Mode=FormMode.New,["XYZ"],ThisItem.'Record Type')

    Set the DisplayMode property of the data card as below:

    If(Form2.Mode=FormMode.New,Disabled,Parent.DisplayMode)

    vqiaqimsft_0-1647594789277.png

     

  • PowerAppsRookie Profile Picture
    87 on 17 Mar 2022 at 12:10:18
    Re: How to make a Form Data Card edit only when in NewForm, and view when in EditForm

    Yes, exactly this

  • ansrikanth Profile Picture
    329 on 17 Mar 2022 at 11:08:39
    Re: How to make a Form Data Card edit only when in NewForm, and view when in EditForm

    are you saying if it s a new form, set the field value to "XYZ" and disable to control so that users cant change the value any more?

     

    Thank you

    -Srikanth

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete