cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Super User
Super User

Re: How do you make a field required?

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Power Apps
Power Apps

Re: How do you make a field required?

(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.

 

Highlighted
Super User
Super User

Re: How do you make a field required?

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Helper II
Helper II

Re: How do you make a field required?

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

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,475)