cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
neill_long
Level: Powered On

Required Field

Ignore this, i managed to solve it. 

 

I have a field in my PowerApp that becomes visible if 'Yes' is selected from a dropdown box.  If Yes is selected, i would like the now visible field to be a required field.

 

If no is selected, then the field doesn't require an answer.  Is there a formula i should add to the required option to make this possible?

 

I have made the field required but if 'No' is selected it wont let the user proceed.

 

thanks

Alistair

1 ACCEPTED SOLUTION

Accepted Solutions
Andy_Tuke
Level 8

Re: Required Field

Good to hear.

 

You might be able to simplify your code though.  Since the Required property is wanting a boolean, and the value of the checkbox is a blooean, you should find that you can set the required property to simply

 

DataCardValue12.Selected.Value (if its a checkbox) or at most

DataCardValue12.Selected.Value="Yes"

 

Andy

View solution in original post

3 REPLIES 3
Andy_Tuke
Level 8

Re: Required Field

I dont believe you can do it that way, but you can achieve the same thing by making the 'Enabled' mode of the Save/Proceed button for example based on the logic.

For the button set the property DisplayMode to something like

 

If (
   (chkOptional.Value && !IsBlank(txtInput)) || !chkOptional.Value, 
   DisplayMode.Edit, 
   DisplayMode.Disabled
)
neill_long
Level: Powered On

Re: Required Field

Hello @Andy_Tuke

 

It seemed to work for me when i added in the Required option - If(DataCardValue12.Selected.Value="Yes",true)

 

If i experience any problems with what i have done then i will certainly try what you have suggested.

 

thanks

Andy_Tuke
Level 8

Re: Required Field

Good to hear.

 

You might be able to simplify your code though.  Since the Required property is wanting a boolean, and the value of the checkbox is a blooean, you should find that you can set the required property to simply

 

DataCardValue12.Selected.Value (if its a checkbox) or at most

DataCardValue12.Selected.Value="Yes"

 

Andy

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,954)