cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
theisogunro
Helper IV
Helper IV

Disabling button based on drop down and empty field

In the form below, I want the Update button to be disabled when the Cancelled or Rejected is selected from Request Status and if the Cancellation/Rejection Reason field is empty

PowerAppsFormula.PNG

 

Below is the formula I have.  Each If statement works independently but when I combine them together, it doesn't work.  Any ideas?

 

 

 

If(
    IsBlank(DataCardValue25.SelectedItems) && DataCardValue1.Selected.Value = "In Progress",
    DisplayMode.Disabled,
    DisplayMode.Edit,
        If(
        (DataCardValue1.Selected.Value = "Cancelled" && IsBlank(DataCardValue48.Text)) || (DataCardValue1.Selected.Value = "Rejected" && IsBlank(DataCardValue47.Text)), 
    DisplayMode.Disabled,
    DisplayMode.Edit
    )
)    

 

 

 

 Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
EddieE
Super User
Super User

@theisogunro 

You typically do not need an If() inside another If(). If() inPowerApps works like this

 

If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

So try rewriting your code like this

If(
    // Condition 1
    IsBlank(DataCardValue25.SelectedItems) && DataCardValue1.Selected.Value = "In Progress",
    // ThenResult 1
    DisplayMode.Disabled,

    // Condition 2
    (DataCardValue1.Selected.Value = "Cancelled" && IsBlank(DataCardValue48.Text)) || (DataCardValue1.Selected.Value = "Rejected" && IsBlank(DataCardValue47.Text)), 
    // ThenResult 2
    DisplayMode.Disabled,

    // Default Result
    DisplayMode.Edit

) 

 

View solution in original post

2 REPLIES 2
EddieE
Super User
Super User

@theisogunro 

You typically do not need an If() inside another If(). If() inPowerApps works like this

 

If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

So try rewriting your code like this

If(
    // Condition 1
    IsBlank(DataCardValue25.SelectedItems) && DataCardValue1.Selected.Value = "In Progress",
    // ThenResult 1
    DisplayMode.Disabled,

    // Condition 2
    (DataCardValue1.Selected.Value = "Cancelled" && IsBlank(DataCardValue48.Text)) || (DataCardValue1.Selected.Value = "Rejected" && IsBlank(DataCardValue47.Text)), 
    // ThenResult 2
    DisplayMode.Disabled,

    // Default Result
    DisplayMode.Edit

) 

 

Thank you!  That worked!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,191)