Skip to main content
Participating Frequently
July 3, 2023
Question

Change icon for all other fields in group

  • July 3, 2023
  • 1 reply
  • 1162 views

I am trying to create a function that will clear the icon for all group fields except the selected one, and choose another for the selected one.

I created button fields and gave them a certain icon. They are named Button.check#0 - Button.check#3.

For instance, when the user will click on +1 (Button.check#1), the +1 button will have the circle icon, and the others will become empty icons, so that the +1 is "marked" for the user. If the user then presses +2 (Button.check#2), the icon there will change and the icon for +1 will clear.

I believe the correct functions to use are buttonGetIcon() and buttonSetIcon() but I have no idea how to utilize them for what I need.

 

Any ideas how this can be done?

Thank you!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 3, 2023

I would use an overlapping matching button with an icon that doesn't have the circle, and then show/hide the fields when needed. Otherwise you'll have to deal with hidden fields that hold the icons for each button, so you could set it back again, and it would become a mess.

If you do it with the double set of buttons all you have to do when one of them is clicked is:

- Hide that field

- Show the matching field

- If the version with the circle is shown, hide all other circle versions (for the other fields in the group) and show the non-circle versions.

Participating Frequently
July 3, 2023

But how do I do that? How do I create a "matching" button?

try67
Community Expert
Community Expert
July 3, 2023

Duplicate the fields you already created, rename them from "Button.check" to "Button.no_check" (for example), change their icons to the non-circle version of the image, and hide them.