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 / Disable save button if...
Power Apps
Answered

Disable save button if 2 conditions are equal

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I would like to disable a save button if 2 dropdown values are the same (for example "Requestor" & "Approver").

Preferrably I would like an error message to appear rather than the button not visible if the 2 conditions are the same value.

 

Does anyone know how to do this? 

Much appreciated 🙂

 

Regards,

Trond

Categories:
I have the same question (0)
  • RakeshPandey Profile Picture
    46 on at

    @Anonymous you can try below formula on DisplayMode of the Button.

    If(Dropdown1.Selected.Value=Dropdown3.Selected.Value,DisplayMode.View,DisplayMode.Edit)

  • KKrishnapriya Profile Picture
    8 on at

    Hi @Anonymous ,

     

    If you are using Model Driven App, you can try using Business rules to show error Message.

     

    Thanks !!

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @RakeshPandey ,

    image.png

     

    Thanks for the quick reply. Unfortunately I receive an error on this formulae: 

    If(DataCardValue7.Value=DataCardValue2.Value,DisplayMode.View,DisplayMode.Edit)

     

     

  • RakeshPandey Profile Picture
    46 on at

    @Anonymous  can you provide the screen shot of the error. Because the one which you have attached is not clear.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @RakeshPandey 

    This is the error:

    image.png

     

     

     

  • RakeshPandey Profile Picture
    46 on at

    @Anonymous Error says that unable to recognise the Datacard. You can remove the datacards and then add it back in to see if the error still happens. You can refer below threads for more details regarding this error.

    https://powerusers.microsoft.com/t5/General-Discussion/Name-isn-t-valid-This-identifier-isn-t-recognized/td-p/296707

    https://powerusers.microsoft.com/t5/General-Discussion/Choice-List-Errors-when-added-to-Form/td-p/180965

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Could you please share more details about the formula you typed within the Items property of the Requestor Dropdown box and Approver Dropdown box?

    Do you want to compare the selected value within the two Dropdown box?

    Which type column in your data source do the two Dropdown box connect to? Person type column in your SP List?

     

    Based on the formula you provided, I think there is something wrong with it. Please consider modify your formula as below:

    Set the DisplayMode property of the "Save" button to following:

     

    If(
     RequestorDropdown.Selected.Value = ApproverDropdown.Selected.Value,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

     

    If the two Dropdown boxes or ComboBox (Requestor & Approver) connects to Person type column in a SP List, please consider modify above formula as below:

    Set the DisplayMode property of the "Save" button to following:

    If(
     RequestorDropdown.Selected.DisplayName = ApproverDropdown.Selected.DisplayName,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    Note: I assume that the Items proeprty of Requestor ComboBox and Approver ComboBox has been set to following individually:

     

    Choices('YourSPList'.Requestor)
    Choices('YourSPList'.Approver)

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    If the Items property of the Requestor ComboBox and Approver ComboBox has been set to following formula:

     

    Distinct(...)

    Please modify above formula as below:

     

    Set the DisplayMode property of the "Save" button to following:

    If(
     RequestorDropdown.Selected.Result = ApproverDropdown.Selected.Result,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    If you want an error message to show up rather than disable the "Save" button, I think a Timer control could achieve your needs. Please add a Timer control in your Edit screen, set the Duration property to following:

    1000

    set the Repeat property and AutoStart property to following:

    true

    set the OnTimerEnd property to following:

    If(
     RequestorDropdown.Selected.DisplayName = ApproverDropdown.Selected.DisplayName,
    Notify("The Requestor you selected could not be same as the Approver, please modify it!", NotificationType.Error) )

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-xida-msft ,

     

    Thanks for the answer :). I think I need to do this differently. Instead of Requestor I need to have the logged in user to NOT be the same as "Approver". Would you know how to do this? 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    If you want to compare the "Approver" with the current login user, please consider modify above formula as below:

    Set the DisplayMode property of the "Save" button to following:

    If(
     ApproverDropdown.Selected.DisplayName = User().FullName,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    or

    If(
     ApproverDropdown.Selected.Email = User().Email,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    Note: I assume that the Approver column is a Person type column in your SP List data source.

    or

    If(
     ApproverDropdown.Selected.Email <> User().Email,
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks @v-xida-msft 

    That worked perfectly 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard