How to create an interaction for 2 checkboxes


#1

Can anyone kindly explain to me how you would write an interaction so that when 2 check boxes are checked an event would trigger


#2

Here is a quick demo:
Multiple checkbox logic.rp (58.3 KB)

There are two checkboxes, “Red” and “Blue” and an ellipse. The ellipse, named “Dot” is represented as a dynamic panel with four states: Default, Red, Blue, and Purple. Clicking the checkboxes will change the state of Dot so it is shown as White (Default), Red, Blue, or if both checked, Purple.

I think for many folks the Axure interaction code required for “multiple select” or any kind of “combo logic” is either too complicated or too simple, depending on your general programming experience. Take a look at the two checkboxes in my example to see how each one handles logic for when it is the only one selected/checked and for when both are selected/checked. The basic method here is for each checkbox to test not only its own selection state (checked/selected or unchecked/unselected) but the selection state of the other checkbox.

If you have more than two checkboxes in a “group” like this, then additional conditional cases are needed to test all the possible (or at least significant) combinations. This can quickly get cumbersome, although fairly straightforward. For more checkboxes, I would recommend a kind of “executive function” like a hidden widget that tests the state of all checkboxes and handles things accordingly. Each checkbox’s Click or Tap event can then “call” or fire the widget’s main event (e.g., Click or Tap or Panel State Changed) to always trigger a test of all checkboxes whenever one of the checkboxes is clicked (or use the Selected or Unselected event if you’d like.)