cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How do i disable button when there is duplicate data

Hi,

I want to disable a submit button when fields have duplicate data; I have a formula which disables the button if the fields have duplicates but it remains disabled after the content of the fields is changed. The formula I am using on the Display variable of the Button is:

If(!IsBlank(Dropdown1.SelectedText.Value)=!IsBlank(Dropdown2.SelectedText.Value)&&!IsBlank(Dropdown3.Selected.DisplayName)=!IsBlank(Dropdown4.Selected.DisplayName),Disabled,DisplayMode.Edit)

 

Any ideas on how this could be made to work?

Thanks,

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
pontusofsweden
Resolver IV
Resolver IV

Hi!

 

Not 100% sure I understand your request but this formula worked for me at least:

 

If(!IsBlank(Dropdown1.SelectedText.Value) && !IsBlank(Dropdown1_1.SelectedText.Value) && !IsBlank(Dropdown1_2.Selected.Type) && !IsBlank(Dropdown1_3.SelectedText.Type);If(Dropdown1.SelectedText.Value = Dropdown1_1.SelectedText.Value || Dropdown1_2.Selected.Type = Dropdown1_3.Selected.Type;Disabled;Edit);Disabled)

 

First, I check if all dropdowns have a value, otherwise it will be disabled. If it returns true though, I go and check if dropdown1 has the same value as dropdown2 OR if dropdown3 has the same value as dropdown4. With this formula, I need to have unique values in each dropdown in order to make the Submit button enabled.

 

Hope this helps!

BR

Pontus

View solution in original post

3 REPLIES 3
pontusofsweden
Resolver IV
Resolver IV

Hi!

 

Not 100% sure I understand your request but this formula worked for me at least:

 

If(!IsBlank(Dropdown1.SelectedText.Value) && !IsBlank(Dropdown1_1.SelectedText.Value) && !IsBlank(Dropdown1_2.Selected.Type) && !IsBlank(Dropdown1_3.SelectedText.Type);If(Dropdown1.SelectedText.Value = Dropdown1_1.SelectedText.Value || Dropdown1_2.Selected.Type = Dropdown1_3.Selected.Type;Disabled;Edit);Disabled)

 

First, I check if all dropdowns have a value, otherwise it will be disabled. If it returns true though, I go and check if dropdown1 has the same value as dropdown2 OR if dropdown3 has the same value as dropdown4. With this formula, I need to have unique values in each dropdown in order to make the Submit button enabled.

 

Hope this helps!

BR

Pontus

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Based on the formula you provided, I think there is something wrong with it. The formula that you provided could only be used to check if the Dropdown box is blank rather than compare the selected values within the Dropdown boxes.

 

I have made a test on my side, please consider take a try to modify your formula as below:

If(
 !IsBlank(Dropdown1.SelectedText.Value)&&!IsBlank(Dropdown2.SelectedText.Value)&&Dropdown1.SelectedText.Value = Dropdown2.SelectedText.Value ||
!IsBlank(Dropdown3.Selected.DisplayName)&&!IsBlank(Dropdown4.Selected.DisplayName)&&Dropdown3.Selected.DisplayName=Dropdown4.Selected.DisplayName,
   DisplayMode.Disabled,
   DisplayMode.Edit
)

Note: I think the combination of Dropdown1 and Dropdown2 should have a "||" relationship with the combination of Dropdown3 and Dropdown4.

 

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

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Pontus,

 

I had to replace a couple of semi colons with commas but otherwise your solution worked perfectly

 

Many thanks

 

Mike

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,358)