web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Button DisplayMode Def...
Power Apps
Answered

Button DisplayMode Default and If Statement

(0) ShareShare
ReportReport
Posted on by 5,331 Moderator

I have CheckBox1 and CheckBox2.

I have EditFormAttachment_DataCardValue.

I have SubmitButton.

Action:
Default DisplayMode = DisplayMode.Edit

If CheckBox1.Value or ChechkBox2.Value equals true and EditFormAttachment is empty SubmitButton should be DisplayMode.Disabled.

If either checkbox is checked and there is no attachment the submit button should be disabled.

I've got the checkbox/attachment part, I just can't figure out the default part.

If(CheckBox1.Value=true Or CheckBox2.Value=true && !IsEmpty(EditFormAttachment_DataCardValue.Attachments.Name),DisplayMode.Edit,DisplayMode.Disabled)

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Phineas,

     

    Instead of defining when the DisplayMode should be Edit, we can define when the button should not be in edit mode. This way all other scenarios will default to DisplayMode .Edit:

     

    If(
     //If either checkbox is checked and there are no attachments set to disabled else edit
     (CheckBox1.Value || CheckBox2.Value) && IsEmpty(EditFormAttachment_DataCardValue.Attachments.Name),
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • Phineas Profile Picture
    5,331 Moderator on at

    Everything worked except -,

    If I leave both check box values as 'false' and add an attachment the Submit button is enabled.

    This should not be.

    Currently:
    Default displaymode.edit (both check boxes 'false', no attachments) - this works.

    Both check boxes 'true' but there is not attachment displaymode.disabled - this works.

    Both check box values 'false' and attachment added the Submit button is enabled - this is NOT working.

    If an attachment is present but neither check box is 'true' Submit button displaymode should be 'disabled'.

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Phineas,

     

    In that case let’s extend the if statement:

    If(
     //If either checkbox is checked and there are no attachments set to disabled else edit
     (CheckBox1.Value || CheckBox2.Value) && IsEmpty(EditFormAttachment_DataCardValue.Attachments.Name),
     DisplayMode.Disabled,
     //Check for no checked boxes
     (!CheckBox1.Value && !CheckBox2.Value) && !IsEmpty(EditFormAttachment_DataCardValue.Attachments.Name),
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    I hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard