Search code examples
ms-officesubmittogglepowerapps

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


Solution

  • 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).