cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 132 members 4,553 guests
Please welcome our newest community members: