(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to validate forms in Power Apps: step by step

João Barros 14 de July de 2026 4 min read

Validating forms in Power Apps stops incomplete or badly formatted records from ever reaching your data source. With the Form control, the Required property on DataCards and a few Power Fx formulas, you can disable the Save button until the data is correct and show clear error messages. The example below uses a simple contacts form with Name, Email and Age.

Prerequisites

  • Access to Power Apps Studio (make.powerapps.com) with a valid licence.
  • A data source with the fields Nome, Email and Idade (Dataverse, SharePoint or Excel).
  • Basic Power Fx knowledge: formulas are written in control properties.
  • A blank Canvas App, tablet or phone layout.

Step 1: Add the form and connect the data source

In the Canvas App, choose Insert > Edit form. In the right-hand pane, set the data source and pick the fields to display. Then configure the form's main properties:

// Form1 DataSource property
Contactos

// Form1 DefaultMode property (new record)
FormMode.New

At this point the form already saves, but it accepts anything. That is what we are about to fix.

Step 2: Mark required fields

Select the Name DataCard and set its Required property to true. Power Apps now flags the field with an asterisk and includes it in its built-in validation. Repeat for Email.

// Required property of DataCard_Nome
true

This is the cheapest validation there is: you write no logic at all and you already gain Form1.Valid, which stays false while any required field is empty.

Step 3: Validate the email format with IsMatch

A required field is not enough: "abc" is filled-in text, but it is not an email. The IsMatch function compares text against a pattern, and Power Fx ships the Match.Email pattern. Add a Label inside the Email DataCard and set its Text property:

If(
    IsBlank( DataCardValue_Email.Text ),
    "Email is required.",
    Not( IsMatch( DataCardValue_Email.Text, Match.Email ) ),
    "Invalid email format. Example: name@company.com",
    ""
)

An If with several condition/result pairs behaves like a switch: it returns the first message whose condition is true, and an empty string when everything is fine. Set the Label's Color property to Color.Red.

Step 4: Validate a numeric range

For Age we only want numbers between 18 and 120. Create another error Label with this formula:

If(
    IsBlank( DataCardValue_Idade.Text ),
    "Age is required.",
    Not( IsNumeric( Value( DataCardValue_Idade.Text ) ) ),
    "Age must be a number.",
    Or(
        Value( DataCardValue_Idade.Text ) < 18,
        Value( DataCardValue_Idade.Text ) > 120
    ),
    "Age must be between 18 and 120.",
    ""
)

Note the Value() call: text input is always a string, and comparing a string with a number throws an error. Converting first is the step most people forget.

Step 5: Disable the Save button

The best validation is the one that prevents the mistake. In the DisplayMode property of the Save button, combine the form's native validation with your custom rules:

If(
    And(
        Form1.Valid,
        IsMatch( DataCardValue_Email.Text, Match.Email ),
        Value( DataCardValue_Idade.Text ) >= 18,
        Value( DataCardValue_Idade.Text ) <= 120
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
)

Step 6: Save and give feedback

In the button's OnSelect, call SubmitForm. Feedback lives on the form's own properties, which know whether the write succeeded:

// OnSelect of the Save button
SubmitForm( Form1 )

// OnSuccess of Form1
Notify( "Contact saved successfully.", NotificationType.Success );
ResetForm( Form1 )

// OnFailure of Form1
Notify( "Could not save: " & Form1.Error, NotificationType.Error )

OnFailure catches the error coming back from the data source (permissions, duplicate key, a server-side mandatory column). Without it, a failed save is silent.

Verify the result

Press F5 to preview the app and test three scenarios:

  1. Empty form: the Save button is greyed out and does nothing.
  2. Email "abc" and age 12: the red messages appear and the button stays disabled.
  3. Valid data: the button becomes active, the record is written and the green notification appears.

Also confirm the record in the data source. If the button never enables, check that the control names in your formula (DataCardValue_Email, for instance) match the real names in the tree view — that is the most common error.

Conclusion

With Required, IsMatch, Form1.Valid and a conditional button you get complete validation without a single line of code outside Power Fx. The natural next step is to push the heavier business rules down into Dataverse (mandatory columns and business rules), so they hold even when data arrives through another channel. Which of your current validations would survive if someone wrote straight to the table without going through the app?