auto-select radio buttons?

cainam
cainam Community Member Posts: 361 ♦ Idol ♦
Is there a way to either automatically select (or deselect) circles in a radio button group?

Scenario:  I have one set of radio buttons show a 2nd set of radio buttons.  Is there a way to automatically have an option on that 2nd set of radio buttons selected based on the first radio button group selection?  (or to change / empty the radio button selection on the 2nd set based on a selection/re-selection of the 1st radio button group?
- Adam Cain

Comments

  • brobertson4402
    brobertson4402 Community Member Posts: 24
    Each radio button has an associated variable.  Use an action to modify the appropriate variable in the 2nd set of buttons when a button is selected from the first set.  Setting a radio button variable to 'on' (without quotes) selects it.  Setting a radio button variable to 'off' (without quotes0 deselects it.  You'll need to add additional actions to handle all the possible scenarios of selecting a button in the first set and selecting/deselecting the appropriate buttons in the second set.   Also actions in the first set of buttons that deselect the other buttons in the first set when one is selected.

    Test questions using radio buttons do this automatically.  You will need to do it manually if you are adding radio buttons to a page that are not part of a test question.

    Hope this helps.
  • cainam
    cainam Community Member Posts: 361 ♦ Idol ♦
    Thanks for the suggestions Brian.  Seems like variables don't exist for each radio button, but for the button group as a whole, and setting the radio button group variable value to 'off', or to one of the radio button specific values doesn't work...

    Is this what you mean by needing to do it manually if not using a test question with radio buttons?  (I didn't use a test question for the radio button groups, instead, clicked on the Test & Survey tab, then Radio Button Group).

    thanks again!
    - Adam Cain
  • timk
    timk Community Member Posts: 1,205 ♦ Idol ♦
    The variable of a radio button group contains the value of the selected button. You can set the groups variable to the value of the button you want selected.

    You need a second action to Run javascript:

    Update_rg447();

    Replace rg447 with the HTML name of the group.
  • cainam
    cainam Community Member Posts: 361 ♦ Idol ♦
    Brilliant!  worked like a charm Tim - thanks!
    - Adam Cain
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 601 eLearning ROCKSTAR Admin Team
    The right, but apparently not obvious, way to do this is to use a "Change Contents" action on the Radio Group object.

    That way you don't have to worry about doing any JavaScript or the html names changing from title to title.

    This updates the variable and the radio group selection. This can also be done on question objects, but again, it's not always so obvious, if you have any ideas on how we can make this more easily discoverable please let me know!

    Thanks, always great to see so many ways to accomplish things in Lectora.

    - Joe
  • cainam
    cainam Community Member Posts: 361 ♦ Idol ♦
    Fantastic Joe - thanks, that worked too!  I did briefly started down the path of 'change contents' when I was trying to figure this out, and I think I rejected my notion that it was the path to a solution when I saw the value of 'set text' as the action, and maybe that turned me off?

    I really just assumed it had to be in the realm of 'change variable' as I was working on it.  ;  )
    - Adam Cain
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 601 eLearning ROCKSTAR Admin Team
    That is great feedback, I can see how "set text" would be misleading. We really should give you the options (possible answers) for whatever object you have selected if it's a question or form or form element.

    Because these input objects are associated with variables it makes sense that the variable can be set, we should probably trigger an update of the input object when an associated variable is modified.

    Thanks for helping us get a better handle on how we can make this work better!

    - Joe
  • timk
    timk Community Member Posts: 1,205 ♦ Idol ♦
    Thanks Joe, great to know. Although I've been working with Lectora for many years, I've never used it for anything else but for changing the contents of textfields. Maybe renaming the action would help ... e.g. just "Change". It would be even less obvious in the first place but it leaves more room for thinking about what might be changeable. Or "Change Contents / Selection".
  • klaatu
    klaatu Community Member Posts: 988
    Since you're sort of on the action editor topic, take a look at what the now defunct ToolBook authoring program used to offer 10 years ago! Why can't Lectora get up to this speed or better?

     
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    You are retired Darrel ! Forget about Toolbook ;-)
  • klaatu
    klaatu Community Member Posts: 988
    Almost retired. LOL. July 31st....
  • carlfink
    carlfink Community Member Posts: 971 ✭ Legend ✭
    I miss ToolBook. I still haven't found a scripting system I like as much as OpenScript.