cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rpoidoma1010
New Member

How do you make a field required?

I don't see a property to make a field required.  What is the best way to check if a field is populated when a user clicks a submit button on a form, and if not populated, highlight fields that need to be populated?  At the very least, I'd like to continue to show a message that required fields are not populated till all of them are.

 

 

11 REPLIES 11

Hi, I have to make the fields mandatory i.e text input and drop downs. I'm not using forms. I'm using the a regular scrollable page which submits the data when I choose the tick icon. How to proceed in that case?

Hi @SHSAHNI ,

Can you clarify why you are using the scrollable page instead of the form control? 

 

Attempting to submit the form would throw errors in the fields where they occur, so no additional work is needed on your end.

 

The form control also has a property called Valid that returns true if the form is filled out to the specifications of each column: required fields are filled in, selections are made for choice columns, etc. You could use that in a condition to warn the user ahead of submission:

If(
    EditForm1.Valid,
    SubmitForm(EditForm1),
    Notify("One or more fields was not filled out correctly.",Warning,2000)
)

This means, "If the fields of the form were filled out, submit the form, else throw the error message."

 

Else, if you are not using the Form control, there is much more logic for you to do for each field one by one. It would look something like this:

If(
    And(
        Not(IsBlank(Trim(TextInput1.Text))),
        Not(IsBlank(Dropdown1.Selected.ID))
    ),
    Patch(...)
)

This means, "If the text in TextInput1 were trimmed and its result is not blank AND if the selected item in Dropdown1 is not blank (something is selected), then execute the Patch() statement."

 

Here's a blog post that @mdevaney published yesterday on validation:

https://matthewdevaney.com/data-validation-for-power-apps-forms/

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,535)