Skip to content
Home » Reset multiple controls or all controls on a form in Power Apps

Reset multiple controls or all controls on a form in Power Apps

Power Apps provides built-in functions such as Reset and ResetFormReset function allows you to reset a control to its Default property value while ResetForm allows you to reset all the controls within a form to their default values.




You can also use the control’s own Reset property to reset the control. By default, it is false, you can change it to true to reset that control value.

Syntax

Reset( Control )

  • Control – Required. The control to reset.

ResetForm( FormName )

  • FormName – Required. Form control to reset to default values.

Let’s understand the use of Reset and ResetForm with the help of an example.

Using Reset function to reset controls values

As you can see, here we have three Text input controls and one Button control on canvas app.

First control named txtname, and its Default property is set to Name.

Second control named txtcode, and its Default property is set to Code.

Third control is txtsales and its Default property is set to Sales.

Fourth control is btnreset.

Let’s reset the controls values on button click.

Go to the OnSelect property of button control and write below formula.

Reset(txtname);
Reset(txtcode);
Reset(txtsales);

In similar way, you can provide the name of all the controls that you want to reset on button click. Here, we want to reset the control name, code and salescontrol.

Run the app now, and you will see that when you change the values of the text input controls and click the Reset button, it promptly resets the control’s values to their default values.

Resetting the controls values from property

You can also reset the control value using control’s Reset property.

Select the control first, in our case we have selected txtname control then go to it’s Advance setting tab then search for Reset property as shown below.

You can see, by default it is false. So, to reset the control set it to true.

Let’s see, how to reset the controls values using their Reset property.




To do this, let’s modify the above formula that we have written on Button click.

Set(
var_resetcontrol,
false
);
Set(
var_resetcontrol,
true
);

In above formula, we have created a variable named var_resetcontrol, and set it’s value to false, and after that set it’s value to true.

Next,  go to each control one by one you would like to reset and set their Reset property to variable var_resetcontrol.

Let’s start with the name control txtname, select the control and go to it’s Reset property and assign the variable var_resetcontrol.

Similarly, repeat the same step for each control you would like to reset on button click. Once you are done with this run the app.

You can see, controls values are reset to their default values on button click.

Resetting control value using Reset property can be considered the best way when you need to reset multiple selective control values. As you do not need to write reset function for each control again and again. You just need to create a variable and assign that variable to each control’s Reset property olny.

Using ResetForm function to reset all the control on a form

Here, we have a Gallery control which and Edit form named EditFormEmp.

To edit the details, user can select an item in gallery and selected item is displayed in Form their user can modify the details and click on Edit button to update the details.

Let’s use ResetForm function to reset all the controls within form to their default values.




First, add the Reset icon. Go to the Insert tab and Search for Reset in search box and select the Reset icon.

Now, go to OnSelect property of Reset icon and write the below formula.

ResetForm(EditFormEmp);

Let’s understand the formula, ResetForm requires the form control name that you want to reset. So, we have provided the form name that is EditFormEmp.

Now, run the app and you can see when you click on Reset icon it resets the all the controls values to their default values.

 

Also Read..

Text function to format date/time or numbers to text string

With function in Power Apps

Filter function in Power Apps

LookUp function in Power Apps

ShowColumns function in Power Apps

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.