Forum Discussion

Jessica_p234's avatar
Jessica_p234
Copper Contributor
Feb 18, 2021

Make Datacard Read Only When user is editing form, but editable when they're creating new form

Hello,

 

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 creating a new form, but if they click edit in the app, it becomes read only and they cannot change it anymore. Is this possible?

  • derhallim's avatar
    derhallim
    Brass Contributor
    You can achieve this by having a rule for the display mode. You can do it by following these steps:

    * Select the card, on the right side panel, click on Advanced, and Unlock to change properties.
    * Now while you're selecting the card, change the properties dropdown to "DisplayMode".
    * In the formula, type this:
    If(SharePointForm1.Mode = FormMode.New, DisplayMode.Edit, View)

    Now that's basically saying, if SharePoint's form mode is New item, then make the current card (your date card) editable, otherwise make it read only (view).
    • SteveMorley1's avatar
      SteveMorley1
      Brass Contributor

      derhallim just because this a couple of years later, when I tried the syntax of If(SharePointForm1.Mode = FormMode.New, DisplayMode.Edit, View) - the view at the end, now needs to be DisplayMode.View

Resources