One of the most useful features to provide in a Form Control in a Canvas Power App is the ability to “Clear/Reset a Form” and “Clear a Field value”.
Let’s look at how Power Apps’ existing feature can help you achieve this.
Clear Field
Let’s say Description field is a lengthy field and often times, you want to clear the entire field instead of just backspacing the entire field.
- Let’s say Description is a DataCardValue in a typical form. Usually Descriptions are lengthy and need to be cleared if you go wrong. So, every form field value is stored in a data card value field.
- On the right hand properties, look for Clear Field option from the list of Text Input properties.
- Notice that a X appears on the field when in focus/active. So when you make a mistake in a field, click on it to clear that field.
- And it get’s cleared.
This didn’t work in Multi-Line Text Box. Not sure if it’s a bug or not supported yet. I’ll confirm and update here.
Reset Form
Fairly basic way to clear out an entire form is to use a button to do so.
- A suitable approach is to add a ResetForm(<FormName>) function. I’ve put a sample button that denotes a reload/reset logo which I selected from Icons.
- Now, let’s say I want to clear this form.
- The form will be cleared.
Here’s a short YouTube video I created to demonstrate this –
Hope this quick tip helps!!
Here are some more Canvas Power App posts you might want to check –
- Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
- Debug Published Canvas Power App with other users using Monitor | Power Platform
- Download a File from a Canvas Power App using a button | Power Platform
- AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
- Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
- Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
- Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
- Implement character length validation in a Canvas Power App | Power Platform
- Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
- Count of total CDS records returned in a Canvas Power App connection [Quick Tip]
Thank you!