Enabling Submit Button with Valid Email Address in Canvas App | PL-400 Exam Preparation

Enable Submit Button with Valid Email Address

Question

You create a canvas app.

On the first screen of the app, you put a Text input field (TextInput1) and a “Submit” button (Button1)

You want to enable the “Submit” button when a user types a valid email address.

Here is your formula:

If(IsMatch(TextInput1.Text, Email), Edit,Disabled).
Where should you put this code?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answer: E

Formulas in Power Apps are similar to Excel.

But in Power Apps, formulas perform operations on the app and app's controls instead of cells and spreadsheets.

For formulas operations, you can use various elements like: Functions - operate on the parameters and return values.

There are specific Power Apps group of functions - behavior functions.

This group describes the behavior of the controls like the Button when you push it.

Signals - provide information about an environment like GPS coordinates.

Enumerations - return predefined constant values like Color with the set of its properties: Color.Red, Color.Blue, etc.

Named operations - return a reference to the app or app's controls like Self, Parent, ThisItem, or ThisRecord.

Controls and their properties - operate on the properties for setting control's configuration.

There is a list of controls that you can use in your apps like Button, Check Box, Column chart, etc.

When you need to change the controls state (Enabled/Disabled) on a canvas screen, you put code in the DisplayMode.

There are three states for the DisplayMode: Edit, Disabled, and View.

By default, the control's DisplayMode is set to Edit.

When the DisplayMode is set to View, the control looks like in the Edit state, but a user cannot select it.

Power Apps

File

Ly

Home Insert View

New screeny ]& Label

Action

Ce) Button

Text v

a
= Input v

Gallery v

FH Datatable [> Forms v

fad Media ~

= fev] If(IsMatch(TextInput1.Text, Email), Edit,Disabled)

lll

i

Tree view

Screens Components

PD Search

EP App

v © Screen1

0 Textinputt

CO Screent

| Input email

C8) Button1

| Submit i

ull Charts v

$3 Icons v

BS Custom ~

eG AlBuildery  & Mixed Real

1: + 8 %

cecontrols | Ys oS FA @

lity v

Pa

BUTTON @)

Button1

Properties Advanced

Text

Display mode

Visible

Pasition
Size

Padding

Color
Border

Border radius
Font

Font size

Font weight
Font style

Text alignment

Vertical align

Submit
t v
o &®
398 40
x y
160 40
Width Height
5 5
Top Bottom
5 5
Left Right
A a
—.> _
10
Open Sans v
15
B Semibold Vv
/ U =

it Middle v

All other options are incorrect.

For more information about managing canvas app controls by formulas, please visit the below URL:

The correct answer is E. Button1.DisplayMode.

Explanation: The formula provided is checking whether the text entered in the TextInput1 field is a valid email address or not using the IsMatch function. The IsMatch function takes two arguments: a string to match and a pattern to match against. In this case, the string to match is the Text property of TextInput1, and the pattern is the "Email" pattern, which is a pre-defined regular expression pattern for email validation.

The If function is used to conditionally set the DisplayMode property of the Button1. If the text entered in the TextInput1 matches the Email pattern, the formula sets the DisplayMode property of the Button1 to "Edit" (i.e., enable the button). Otherwise, it sets the DisplayMode property to "Disabled" (i.e., disable the button).

Therefore, to achieve the desired behavior of enabling the Submit button when a valid email address is entered, you should put this formula in the DisplayMode property of Button1. The other options (A, B, C, and D) are not relevant to this scenario.