Latest Posts

PowerApps Reset control back to default value


The Reset function in Power Apps is used to reset a control back to its default value. This function is particularly useful for clearing input fields, resetting form controls, or reverting other interactive elements to their initial state.

PowerApps – Reset() function Syntax

Reset(Control)

  • Control: The control you want to reset.

Notes:

  1. Default Values: Ensure that the controls have appropriate default values set for the Reset function to work as expected.
  2. User Feedback: Provide visual feedback to users to indicate that the controls have been reset.
  3. Clearing Input Fields: Reset input fields after form submission or when the user wants to clear the form.
  4. Reverting Changes: Allow users to revert changes and restore default values in forms and other interactive elements.
  5. Improving User Experience: Enhance user experience by providing an easy way to reset controls.

PowerApps - Reset a Text Input Control

Suppose you have a Text Input control named TextInput1, and you want to reset it to its default value when a button is clicked.

Reset(TextInput1)

When the button is clicked, the TextInput1 control will be reset to its default value.

PowerApps – Reset Multiple Controls

Suppose you have multiple controls that you want to reset at once, such as a Text Input and a Dropdown.

Reset(TextInput1);

Reset(Dropdown1);

When the button is clicked, both TextInput1 and Dropdown1 will be reset to their default values.

PowerApps - Resetting a Form Control

Suppose you have a form control that you want to reset to its default values.

  1. Add a Form Control:
    • Insert an Edit Form control and name it EditForm1.
    • Set its DataSource property to a data source (e.g., Employees).
    • Set its Item property to a specific record or default values.
  2. Add a Button Control:
    • Insert a Button control.
    • Set the Text property of the Button to "Reset Form".
    • Set the OnSelect property of the Button to:

ResetForm(EditForm1)

When the button is clicked, the EditForm1 control will be reset to its default values.

PowerApps – Reset control and notify

Here’s a comprehensive example that demonstrates using the Reset function to reset multiple controls and provide feedback upon success:

  1. Add a Text Input Control:
    • Insert a Text Input control and name it TextInput1.
    • Set its Default property to an empty string or any default value.
  2. Add a Dropdown Control:
    • Insert a Dropdown control and name it Dropdown1.
    • Set its Items property to a list of values (e.g., ["Option 1", "Option 2", "Option 3"]).
    • Set its Default property to the first item in the list.
  3. Add a Button Control to Reset Controls:
    • Insert a Button control.
    • Set the Text property of the Button to "Reset All".
    • Set the OnSelect property of the Button to:

Reset(TextInput1);

Reset(Dropdown1);

Notify("Controls have been reset", NotificationType.Success)

  1. Add a Label Control to Display Messages:
    • Insert a Label control to display messages such as reset status.
    • Set the Text property of the Label to an empty string initially.

This setup allows users to reset both a Text Input and a Dropdown control by clicking the "Reset All" button. The app provides feedback that the controls have been reset. By effectively using the Reset function, you can manage control states and improve the user experience in your Power Apps applications.


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint