cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BillKern
Helper III
Helper III

Re: How do you make a field required?

Hate to revive an outdated thread, but I do not see a Required option anywhere on my Text Input boxes.

Nothing here:

BillKern_0-1594328195745.png

Nothing here:

BillKern_1-1594328236708.png

 

 

Have they removed this option? Or is it not available to me for some reason? Here is my tree view if that helps:

 

BillKern_2-1594328324785.png

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@BillKern 

In all my years I've never seen a Required property on a TextInput control.  I believe you might be confusing with the Required property that is found on a DataCard in a Form control.  The required property on the DataCard plays into the logic for the Form Validation.

 

TextInput controls by themselves do not have a Validation capability.  Making a TextInput control required is part of your OWN logic for validation. 

Ex. Setting a "submit" button to disabled if the TextInput control is blank.  Showing a "Required" label if not filled in, etc.

But these are all part of your own logic.

 

If you want a Required control, it would need to be in a Component capable of Validation.  The only one that comes to mind is a Form Control.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
Mr-Dang-MSFT
Power Apps
Power Apps

(I moved this message to its own topic so your question is not buried at the bottom of a thread)

 

The Required property is available in the Form control. If you have a form, each data card will be required if the underlying data source has that field required. You can also force a data card to be required by setting its Required property to true and it will only be required in the given app.

 

The form control in Power Apps handles the requirements without any additional work on your part besides flipping the property true/false. An error will appear in the form automatically if the user attempts to SubmitForm without filling out the required field.

 

If you want to require a field outside of a form, you can create this experience by wrapping a condition around the action you want.

For instance, suppose you have a button that has an action OnSelect to patch some data. You can use a condition like this to require a value in the text box:

If(
    !IsBlank(Trim(TextInput1.Text)),
    Patch(...)
)

 

This means, "Trim the spaces in the text input box. If the result is not blank, then patch the data (or do whatever action you want)."

 

Let me know if this helps.

 

RandyHayes
Super User
Super User

@BillKern 

In all my years I've never seen a Required property on a TextInput control.  I believe you might be confusing with the Required property that is found on a DataCard in a Form control.  The required property on the DataCard plays into the logic for the Form Validation.

 

TextInput controls by themselves do not have a Validation capability.  Making a TextInput control required is part of your OWN logic for validation. 

Ex. Setting a "submit" button to disabled if the TextInput control is blank.  Showing a "Required" label if not filled in, etc.

But these are all part of your own logic.

 

If you want a Required control, it would need to be in a Component capable of Validation.  The only one that comes to mind is a Form Control.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@RandyHayes Thank you for the clarification. I did end up adding this to my submit button and works as I intended.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Users online (1,430)