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 you'll understand how a form lets users create and update records, and what makes a submit reliable.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().4. SubmitForm() and the lifecycle
The function that actually writes to your data source is SubmitForm(), which you wire to a Save button. Pass it the form's name, and Power Apps validates each card and then submits. There are two outcomes: the write succeeds and the form's OnSuccess property fires, or it fails, because a required field is empty or the network drops, and OnFailure fires instead. You hook your follow-up actions to those events.5. OnSuccess, OnFailure, OnReset
Three form events to wire. The standard OnSuccess chain is three calls in a fixed order, shown on the slide: notify the user that the save worked, refresh the gallery so it picks up the new row, then navigate back to the list. Keep that order, and never reset the form 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 is an often forgotten step. The user submits a new ticket, the form returns to the gallery, and the new ticket isn't there until a reload, because galleries cache their data and don't refresh on their own. The fix is one call on the form's OnSuccess: Refresh of the Tickets list, which forces Power Apps to re-read the data. If you leave it out, your app users might think their 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, which looks broken. NewForm blanks the fields the next time anyway. The right home for ResetForm is a Cancel button next to Save, which clears the form and then navigates back for the user who changes their mind partway through.8. Patch()
One more function you're likely to come across: Patch, which writes to a data source without 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 the Edit Form is the right shape for everything you'll build here, but it's worth exploring once you're comfortable with forms.9. What you'll practice
In the exercises you'll work through how an Edit Form is set up, what happens after a successful or failed submit, and how New and Cancel buttons complete the form lifecycle.10. Let's practice!
Time to practice.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.