Skip to main content

I want an if statement where two booleans are true, in order to navigate to another artwork, when a button is clicked.



In my design, when the user clicks “match file” I want my prototype to check first if two of the booleans are true, before it takes me to another artwork.


so, inside of my component, I created a conditional interaction:|


if boolean1 === true and boolean2 === true

navigate to “flowerror”

else

navigate to “home”


when i copy and paste this component in my art work and click on play to see the prototype, it doesnt work. what am I doing wrong? please advice.

For “equal to” make sure you are using “==“ vs “===“.


yes, sorry it is “==” but it’s still not working 😦

image


When and where are you setting the booleans to true or false? It could be one of those booleans is not being set to true before the on click is called.


So, first I set them to either true or false when clicking a checkbox:

image

image


then, when I click a button on a dropdown menu, I want to check if two of those variables are true:

image


then I copy the dropdown component into my artwork (the checkboxes are already there) and when I test it in the prototype, it doesn’t work 🤷‍♀️


Thanks for sharing. In your example, I see row1 being set, but where do you set the variable “row2” do you use another checkbox for that? If you share the file view only, I could dig in more to see what’s up.


yes, I created two separate checkboxes and gave them each a boolean variable. checkbox1 has row1 boolean and checkbox2 has row2 boolean.

Let me recreate the problem on another Figma prototype so I can share it since this one in particular has proprietary info.


Here is a rough example based on what you showed. Hope it helps.


View Prototype

View File


Reply