cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JayashreeKrish
Resolver II
Resolver II

Disable Button based on multiple nested IF conditions

I created a canvas app using sharepoint list.I have three non mandatory fields here. (Zip, SSN, Date of Birth)


The Submit button should be disabled under the following condition

If ZIP CODE has value and if the value doesnt matches the regex expression  or
If SSN has value and if the value doesnt matches the regex expression or
If Date Of Birth and if the value doesnt matches the regex expression


If they dont have value , The submit button is enabled (this is by default , since they are non-mandatory)

 

How can I combine all the three conditions in one formula?
The below one is throwing error.Please help.

Under "DisplayMode" of Button , I have include this piece of code.

 

 

 

If(DataCardValue49.SelectedDate > Today(), DisplayMode.Disabled, DisplayMode.Edit)

If(
    Not(IsBlank(DataCardValue50.Text)),
    If(
        IsMatch(DataCardValue50.Text,"^\d{3}-\d{2}-\d{4}$",MatchOptions.Complete),
        DisplayMode.Edit,
    DisplayMode.Disabled
    ),
   DisplayMode.Edit
)
If(
    Not(IsBlank(DataCardValue48.Text)),
    If(
        IsMatch(DataCardValue48.Text,"^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$",MatchOptions.Complete),
        DisplayMode.Edit,
    DisplayMode.Disabled
    ),
   DisplayMode.Edit
)

 

 

 

 

 

 

13 REPLIES 13
JayashreeKrish
Resolver II
Resolver II

Thanks much @PG_WorXz10  and @Nogueira1306  for helping out

 

JayashreeKrish
Resolver II
Resolver II

This code worked. Thanks @JR-BejeweledOne  for helping out.

 

 If( !IsBlank(DataCardValue48.Text) && !IsMatch(DataCardValue48.Text,"^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$",MatchOptions.Complete),DisplayMode.Disabled, !IsBlank(DataCardValue48.Text) && !IsMatch(DataCardValue50.Text, "^\d{3}-\d{2}-\d{4}$",MatchOptions.Complete),DisplayMode.Disabled, DataCardValue49.SelectedDate > Today(), DisplayMode.Disabled, DisplayMode.Edit ) ; 

StalinPonnusamy
Super User
Super User

Hi @JayashreeKrish

 

If(
    (If(
        Not(IsBlank(DataCardValue9.Text)),
        IsMatch(
            DataCardValue9.Text,
            "^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$",
            MatchOptions.Complete
        ),
        true
    ) && If(
        Not(IsBlank(DataCardValue10.Text)),
        IsMatch(
            DataCardValue10.Text,
            "^\d{3}-\d{2}-\d{4}$",
            MatchOptions.Complete
        ),
        true
    ) && DataCardValue14.SelectedDate > Today()),
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

JayashreeKrish
Resolver II
Resolver II

Thanks @StalinPonnusamy 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,230)