Forum Discussion

AndrewCrosby-fb's avatar
AndrewCrosby-fb
Community Member
4 years ago

How To Display Radio button Totals Without Clicking A Button

Hello,
I'm new to working with variables and I've come a long way in trying to solve this problem. 
In the attached Storyline file, I have a series of radio buttons. A learner can select radio buttons for values of 0, 1, or 2 in each of three rows.
Along the right edge, I am displaying the current values of each row, and below them a sum of all three rows.

In theory, the sum value at the lower right can only be a number between 0 and 6. But, if the user clicks any of the radio buttons (for values 1 and 2) more than one time, the total keeps increasing to numbers larger than 6.

How do I alter this SL file so that the value at the lower right ALWAYS reflects the sum of the three values above it, without using a button that triggers a calculation?

  • You need a trigger that wipes out the current value.

    I'd try this:

    1. subtract variable score 1 from AddTotal
    2. Set score 1 to X
    3. Add variable score 1 to AddTotal

    Something like that should work on the click...it essentially subtracts the value of the variable and adds the new value.

  • Thank you SO much ... this really was a huge step forward in solving this problem - I learned a great deal by viewing your update of the SL file!

    I ran in to one issue: If the learner selects a '1' or a '2', and then changes their mind and clicks the '0' button, the 'AddTotal' wouldn't reflect that update.

    So - I added a new trigger to the 'zero' radio buttons that goes like this: (Example is for the first row of radio buttons) 
    Subtract variable score1from AddTotal
      When the user clicks 1Radio Button_0
        If score1 > value0

    That seemed to fix the problem. Or was that the best way to go about it?
    I've attached the newly revised SL file.

    Thanks again for your help!

    • TomKuhlmann's avatar
      TomKuhlmann
      Staff

      That seems right. I didn't add the trigger to the zeros in the demo.