Message Boards Message Boards

Back

Take an action once a set of objects have been clicked in any order

Toggle
One common functionality I require quite often is that to take an action once a set of objects have been clicked. These clicks could be in any order rather than sequentially.

I know how to increment / decrement a variable on a click but clicking on the same object can keep incrementing the variable (unless I disable the clicks on that).

I was wondering if there was a more elegant solution available to this issue which I could re-use easily on other pages too.

Please advise. 
0 (0 Votes)

RE: Take an action once a set of objects have been clicked in any order
Answer
9/30/20 4:13 PM as a reply to D Singh.
Hi Daljit,
This is an interesting idea. It's a bit limited to buttons, so I'm not sure quite how we would implement this - there would have to be some way to determine which buttons you care about, and which you do not, and then a way to detect when only those buttons have been clicked. Since everything is object-based, I'm not sure what the object would be to house this functionality. We'll discuss this more with our development team to see if this can be done in a more integrated way.

There is a way to do this using list variables, that can be reused pretty easily. Check out this video - https://share.smartbuilder.com/public/support/criteria-for-completing-page.mp4

Basically, onPageLoad you reset your "completion-criteria" variable (in the video it's called "complete-this-page") to be a list of all the buttons with a certain tag. Then, as each button is clicked, it is removed from that list. When the list is empty, the page is considered complete, and you can do whatever you want (display a message, show a button, fire a global event).

Note that you want to make your tag something unique (in the video I just use "button"), and definitely not something that is also used on a Master (because those items will also need to be clicked on).

Sample lesson attached.
+1 (1 Vote)