J.Con
J.Con

Reputation: 4309

Power Apps - Checked toggles reset after Submitform

I am new to Powerapps. I have a number of toggles in an EditForm named EditForm1. When the toggles are checked they cause text input boxes to appear, these can then be used to enter new information.

I then have a SubmitForm button (SubmitForm(EditForm1)), which saves the new information to an Excel table via Dropbox. Everything works fine except when I press the SubmitForm button the toggles return to their default mode, which is off. How can I keep the toggles on after submitting? Thank you

Upvotes: 0

Views: 4512

Answers (2)

Meneghino
Meneghino

Reputation: 1021

There are two ways PowerApps controls can be reset to their default value:

  1. through the control's own Reset property
  2. by calling the Reset(MyControl) function

So I would first check the Reset property of the toggles and set it to nothing or 'false', and then check the form's OnSuccess and similar properties to see if the Reset function is called from there.

Finally, if all this fails, I would abandon the out-of-box forms and build your own so that you have full control over behaviour, see this post for an example.

Upvotes: 1

J.Con
J.Con

Reputation: 4309

I was able to get the answer to this question from the PowerApps forum (https://powerusers.microsoft.com/t5/PowerApps-Forum/Submitform-resets-toggles/m-p/62742#M25890).

Basically, using toggles inside a form was the problem, since submitting forms causes the controls to reset. So the solution was to remove the form and include my toggles on a blank canvas. Then, instead of using Submitform(), I use the Patch() function like so

Patch( DataSourceName, Record, { DatasourceColumnname1: datasourcecolumnname1.Text, DatasourceColumnname2: datasourcecolumnname2.Text, ... })

Where DatasourceColumnname1 is the name of the column in the data source, and datasourcecolumnname1.Text is the information I would like added to the data source (in this case, text inside a text input box).

Upvotes: 0

Related Questions