Forms and data entry
1. Forms and data entry
Until now your app only reads. This video is about writing back: adding an Edit Form, controlling its mode, submitting cleanly, and handling success and failure. By the end, users can actually create and update records from your app.2. The Edit form control
The control that handles editing and creating rows is the Edit Form. Click + Insert, then Edit form. Set its DataSource property to your tickets list, and Power Apps auto-generates one input card per column, a text input for Title, a dropdown for Status, a date picker for DueDate, and so on. You don't have to wire anything per-field; the form does it for you.3. Form modes: New / Edit / View
A single Edit Form actually has three modes. FormMode.New shows it blank, ready to create a record. FormMode.Edit pre-fills it with an existing row that the user is updating. FormMode.View shows the same row read-only. Set the form's DefaultMode property to one of these to pick the starting state, then switch on the fly with NewForm(), EditForm(), or ViewForm(). One form control, three behaviors.4. SubmitForm() and the lifecycle
The function that actually writes to your data source is SubmitForm(). Pass the form's name and Power Apps validates each card, then submits to the data source. Two outcomes. The write succeeds, and the form's OnSuccess property fires; or it fails (a required field is empty, the network drops), and OnFailure fires instead. You hook your follow-up actions to those events. Always know which one you're handling.5. OnSuccess, OnFailure, OnReset
Three form events to wire. The standard OnSuccess chain is three calls in a fixed order, shown on the slide: first notify the user that the save worked, then refresh the gallery so it picks up the new row, then navigate back to the list. Keep that order, and never reset the form in here; more on that in a moment. OnFailure is usually a single notification with an error style. And OnReset runs when the form is reset, which is typically left empty.6. Refresh(), the forgotten step
Here's a bug that catches almost everyone. The user submits a new ticket, the form returns to the gallery, and the new ticket isn't there; it only shows up after a reload. The reason is that galleries cache their data and don't refresh on their own after a submit. The fix is one function call on the form's OnSuccess, Refresh of the Tickets list, which forces Power Apps to re-read the data. Leave it out and your users will think the save didn't work.7. ResetForm(), the cancel path
One more habit worth getting right. ResetForm clears the form's fields. The instinct is to put it on OnSuccess, but don't. The form is already leaving the screen there, so resetting it at the same time makes the fields blink empty for a moment, which looks broken. The next time you open a new form it starts blank anyway. The right home for ResetForm is a Cancel button next to Save, which clears the form and then navigates back. That covers the user who changes their mind partway through. The successful save path stays the same chain you just saw, notify, refresh, navigate, with no reset mixed in.8. Patch() is out there too
One more function you're likely to come across. The Power Apps community talks a lot about a function called Patch. It writes to a data source without needing a form control: you give it the source, the record to update, and the changes to make. It's handy for bulk updates or quick one-field tweaks. We don't use it in this course, because for everything you'll build here the Edit Form is the right shape. It's a powerful tool to explore once you're comfortable with forms.9. What you'll build
In the exercises you'll add an Edit Form, handle what happens after a successful or failed submit, and add New and Cancel buttons for the full form lifecycle.10. Let's practice!
Time to make your tickets writable.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.