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 / Best practice to reset...
Power Apps
Answered

Best practice to reset custom form fields

(1) ShareShare
ReportReport
Posted on by 41
Hello, I am working on a canvas app and I am using a container to create a form in a specific design for users. I am using the patch function with some validation on the input fields. However, I can easily patch the data back to SharePoint, but what I can't seem to find online is an efficient way to reset the fields when a users has submitted the form. Right now, my button to submit has a displaymode to make sure all inputs have met their validations and once they have the displaymode becomes "edit'. I then patch the data back to SharePoint, but after that where do I reset my controls? Is there a proper way to do it after the data has successfully patched to SharePoint? 
Categories:
I have the same question (0)
  • Suggested answer
    tsa-svd2srv Profile Picture
    204 on at
    Assuming it's some sort of "Submit" butt that contains the Patch function, please provide the code from your OnSelect property.
     
    Off the top of my head, I think your going to need something like:
    YourCurrentCode(
    .
    .
    .
    );
    Reset(ControlName1);
    Reset(ControlName2);
    Reset(ControlName3);
    Reset(ControlName4);
    Reset(ControlName5);
    
    and so on.
     
    Let me know if it works.
     
  • Suggested answer
    timl Profile Picture
    36,774 Super User 2026 Season 1 on at
     
    The ResetForm function will reset all controls on a form back to their initial values. Perhaps that might help you?
     
    ResetForm(YourForm)
      
     
  • Verified answer
    Signstech Profile Picture
    7 on at
    You have two good answers as replies.   To take each a step further for both replies...
     
    • As @ElvirBotic response provided...if you are using a 'FORM', then you can add the 'ResetForm' formula to the OnSelect property, after the Patch.
      • Example(s)
        • OPTION 1
    // OnSelect property of your Submit Button
    Patch(SharePointList, Defaults(SharePointList), YourFormName.Item);
    ResetForm(YourFormName)
    • OPTION 2
    //OnSuccess property of your Form
    ResetForm(YourFormName)
    * NOTE: If a failure occurs during the save, you don't want the form to reset, clearing out the data in the fields.  To avoid this, you should place the ResetForm formula inside the //OnSuccess property of your Form and not within the OnSelect property.
     
    • Agree with @tsa-svd2srv response.  If you are not using any form, but you have a bunch of TextInput fields within a container to look like a custom form, then yes, you will have to add each field to the to the OnSelect property after the Patch.
    // OnSelect property of your Submit Button
    Patch(SharePointList, Defaults(SharePointList), {
    Title: TextInput.Text,
    Description: DescriptionInput.Text,
    // Add other fields here
    });
    
    // Reset each control
    Reset(TextInput);
    Reset(DescriptionInput);
    // Add the rest of you Reset functions for all other input controls
  • timl Profile Picture
    36,774 Super User 2026 Season 1 on at
     
    @ElvirBotic is Patching the data to SharePoint, therefore OnSuccess is not applicable because this only applies when calling SubmitForm.
     
    Also, the Updates property of the form returns all updated fields on a form. The form control does not expose a property called Item.
     
    The correct approach error checking is to call IfError like so.
     
    IfError(
        Patch(SharePointList, Defaults(SharePointList), YourFormName.Updates),
        Notify("An error occurred while saving the record.", NotificationType.Error),
        ResetForm(YourFormName)
    )
     

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
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard