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 / How to choose mode whe...
Power Apps
Unanswered

How to choose mode when previewing form

(0) ShareShare
ReportReport
Posted on by 18

I'm in designer, working on my SharePoint based form. I want to see how something works, so I click Alt and create a new item and save it.

 

When I exit preview mode, the values are still on the form.

 

In the real world, I'd close the form and choose another item, or click New to create a new one.

 

How do I reset the form in designer? I don't want to change the functionality of the form itself, just for while I'm working on it. Can I choose to preview it in Edit mode or New mode?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @marymascari 

    What is shown in the form is *completely* dependent on the Item property of your form.  If you have a record in it and your form is in any mode except new, then you will see that record.

    If you just want your form to go into a new mode when you submit the record, then put the following in the OnSuccess action of the form:  NewForm(yourFormName)

     

    I hope this is helpful for you.

  • marymascari Profile Picture
    18 on at

    So if I want the form to do something different in the "real" world, I have to change that before I publish? For example, when the user clicks Submit, I want it to submit the form and then display the view form so they can see what they did.

     

    In a regular Canvas app, I'd have a view form and an edit form, but in SharePoint, there's just the one with different modes. And which mode it starts with depends on what the user does from SharePoint; whether they click New Item, choose an existing item to view, or edit the item they've chosen.

     

    I guess I'm wondering how to simulate those states while testing. Is the only way to do that to manually change the OnSuccess property?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @marymascari 

    It's all about the three functions - NewForm, ViewForm and EditForm.

    All of these functions change the mode of the form.  If you have one form, here is how it plays out.

     

    ViewForm(yourForm) - when you issue this, the form sets itself into View mode.  It will show any record that is supplied in the Item property of the form.  This is equivalent to setting the DisplayMode of the form to View.

     

    EditForm(yourForm) - when you issue this, the form sets itself into Edit mode. It will show any record that is supplied in the Item property of the form.  This is equivalent to setting the DisplayMode of the form to Edit.

     

    NewForm(yourForm) - when you issue this, the form sets itself to Edit mode and ignores the Item property of the form.  Internally, it sets the record to Defaults(yourFormDataSource) which is an empty record.  This is equivalent to setting the DisplayMode of the form to Edit and setting the Item property to Defaults(yourFormDataSource)

     

    So, bottom line - and EditForm is able to do all three of the above.  The three functions are all shortcuts for you to set the mode and item of the form.  

     

    And, as a side note, the ViewForm can only be in view mode.  There is no way to alter that, nor to issue the three commands for a ViewForm.

     

    If you want to simulate this in design, you can put in controls to force those functions.  For example, if you want to simulate New, add a button and set the OnSelect to NewForm(yourForm)

    If you want to simulate View, then another button to : ViewForm(yourForm)

     

    You can make those buttons visible when in design mode.

     

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
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard