cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikiepat
Helper III
Helper III

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

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @mikiepat ,

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.
mikiepat
Helper III
Helper III

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (996)