Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Radio Button Help

1684304343
Stephen C.
Pro
Sheet Author
On the Star Wars Saga Edition sheet, there is a condition tracker which is a radio button group. This information needs to be displayed on two separate tabs. If I change both groups to have the same name, then the selected button only actually shows on one tab. I need a way to have both radio button groups display the same thing, and to change when the other is changed. I'm ok with having two different names for the groups, but I want to be able to call the first one rather than having to discern between the two. Any suggestions on how to do this?
1684306785
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
I have not tested this, but I would have thought that it would work fine as you describe it (assuming the two groups have the same name, and the same values, etc).  If for some reason it is not working, you should be able to easily fix it with sheetworkers.  on("change:button1", function ocwttest1() { 'use strict'; getAttrs([ "button1", "button2" ], function(values) { 'use strict'; setAttrs({ "button2": values[ "button1" ] }); }); }); // End on change wt-test1 Same thing with button2
1684317442
Stephen C.
Pro
Sheet Author
The radio button groups have more than two options. <td rowspan="5" style="text-align:left"> <input type="radio" value="0" name="attr_CT" checked="true" /> <span data-i18n="ct_normal">Normal</span><br /> <input type="radio" value="-1" name="attr_CT" /> -1<br /> <input type="radio" value="-2" name="attr_CT" /> -2<br /> <input type="radio" value="-5" name="attr_CT" /> -5<br /> <input type="radio" value="-10" name="attr_CT" /> -10<br /> <input type="radio" value="0[Helpless]" name="attr_CT" /><span data-i18n="ct_helpless">Helpless</span> </td> <td rowspan="4" style="text-align:left"> <input type="radio" value="0" name="attr_CT" checked="true" /> <span data-i18n="ct_normal">Normal</span><br /> <input type="radio" value="-1" name="attr_CT" /> -1<br /> <input type="radio" value="-2" name="attr_CT" /> -2<br /> <input type="radio" value="-5" name="attr_CT" /> -5<br /> <input type="radio" value="-10" name="attr_CT" /> -10<br /> <input type="radio" value="-10[Helpless]" name="attr_CT" /> <span data-i18n="ct_helpless">Helpless</span> </td> I'm not exactly sure how that would work in this case. The groups have the same name, so where would that go in your code? And would I use the values where you have "button1" and "button2"? (And so on for all 6 buttons)
1684317963

Edited 1684318131
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
Sorry, I was unclear. I meant to say that you could split them up and structure them as two separate radio button groups. buttonGroup1, and buttonGroup2.  Then if the user presses buttonGroup1 button that sets it to -5, the sheetworker just sets attr_buttonGroup2 to -5 as well, keeping the two buttonGroups in sync.. 
1684319194
Stephen C.
Pro
Sheet Author
You know what? I did a bit of searching and came across a suggestion to change them from radio buttons to checkboxes. And doing that appears to do exactly what I want. (Though I do have to do a bit of formatting to make it look ok.) I appreciate the time that you took to answer, though.