How to Create an Action for a Button with Variables

This is what I am trying to do with 10 buttons on a page (yup need all 10). I believe I need to create variable, but am not sure where to start.

* When Button 1 is showing content (Content 1)

* And Content 2-10 is hidden

* And another button (2-10) is selected

* Hide Content 1

* And Show related content of button selected

Background

I have created an action where each button toggles to hide and show its own content.

Now I need the content to hide when another button is se lected, before the new content shows.

Discussion (3)

Hi LisaB.

To do this I normally create an action group (Insert -> Group) and inside that group I add an action to clear each content. In your case there would be 10 actions.

Then on each of the buttons add the following actions:

  1. Mouse Click -> Run Action Group -> Your group to clear all actions

  2. Mouse Click -> Show -> The proper content

Bonus: no variables required. :)

Hope this helps!

Thanks @susanmacnab ! I will give this a try and get back to you.

Love the "no variables required"!

Hi @LisaB2022. I just thought of something else.

Depending on your needs, another thing you can add to your action group is actions to reset each of your buttons to "normal" state.

It all depends on how you built your page. Also if you're using Lectora 21 and you "group" your buttons, it shouldn't be required at all...