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

Repeating Sections and Radio Buttons

1418703230
Finderski
Plus
Sheet Author
Compendium Curator
I'm having a problem with Radio buttons in a repeating section and macro buttons. Some Background: So, I'm doing some fun (for me) stuff with the Savage Worlds Character Sheet for the next round of enhancements. Most Savage Worlds Character sheets that PEG provides include dice icons for the Attributes and Skills; I wanted to incorporate that a bit, but given that the limitations of &lt;select&gt; and &lt;radio&gt; buttons, for CSS styling, I wanted to give people an option for what to use. So, I have the sheet working to show the dice icons or the normal drop down menu if that's what they prefer. Everything works beautifully for the all the static stuff. And, thanks to Brian, I have the visuals working for repeating sections except... The Problem: If I have the dice icons showing (i.e. using the radio buttons), it will only roll a d4, regardless of what I have selected, UNLESS I've changed the die type using the normal drop down menus, in which case the buttons will only roll that value regardless of what I have selected using the radio buttons. I'm sure it has something to do with the radio and selection options both being there, as when I remove one set everything works... Here's the code: &lt;input type="checkbox" class="sheet-NewDieType" name="attr_DieTypeConfig" style="width: 15px; display: none;" /&gt; &lt;fieldset class="repeating_skills"&gt; &lt;div class='sheet-row'&gt; &lt;div class='sheet-col' style='width:310px;'&gt; &lt;div class="sheet-dtypedropdown"&gt; &lt;div class="sheet-dietype"&gt; &lt;input type="radio" name="attr_SkillNameRank" value="4" checked="true" style="width:10px;" /&gt; &lt;span&gt;d4&lt;/span&gt; &lt;input type="radio" name="attr_SkillNameRank" value="6" style="width:10px;"/&gt; &lt;span&gt;d6&lt;/span&gt; &lt;input type="radio" name="attr_SkillNameRank" value="8" style="width:10px;"/&gt; &lt;span&gt;d8&lt;/span&gt; &lt;input type="radio" name="attr_SkillNameRank" value="10" style="width:10px;"/&gt; &lt;span&gt;d10&lt;/span&gt; &lt;input type="radio" name="attr_SkillNameRank" value="12" style="width:10px;"/&gt; &lt;span&gt;d12&lt;/span&gt; &lt;div class="sheet-d4"&gt;d&lt;/div&gt; &lt;div class="sheet-d6"&gt;f&lt;/div&gt; &lt;div class="sheet-d8"&gt;h&lt;/div&gt; &lt;div class="sheet-d10"&gt;k&lt;/div&gt; &lt;div class="sheet-d12"&gt;l&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;input type="checkbox" class="sheet-NewDieType" name="attr_DieTypeConfig" style="width: 15px; display: none;" /&gt; &lt;div class="sheet-dtypeOrig"&gt; &lt;select name="attr_SkillNameRank" class="dtype" value="4" style='width:55px;'&gt; &lt;option value="4"&gt;d4&lt;/option&gt; &lt;option value="6"&gt;d6&lt;/option&gt; &lt;option value="8"&gt;d8&lt;/option&gt; &lt;option value="10"&gt;d10&lt;/option&gt; &lt;option value="12"&gt;d12&lt;/option&gt; &lt;/select&gt; &lt;/div&gt;+&lt;input type="number" name="attr_SkillNameMod" class="sheet-short" value="0" style='width:50px;'/&gt; &lt;input type="text" name="attr_SkillName" value="Skill Name" style='width:152px;'/&gt; &lt;/div&gt; &lt;div class='sheet-col' style='width:198px;'&gt; &lt;span style='text-align:bottom; font-weight:bold;'&gt;d&lt;/span&gt;&lt;input type="number" name="attr_LinkedSkillNameAttScore" class="sheet-short" value="@{LinkedSkillNameAtt}" disabled="true" /&gt; &lt;label style='width:130px;'&gt; &lt;select name="attr_LinkedSkillNameAtt" class="atype"&gt; &lt;option value="@{agility}"&gt;Agility&lt;/option&gt; &lt;option value="@{smarts}"&gt;Smarts&lt;/option&gt; &lt;option value="@{spirit}"&gt;Spirit&lt;/option&gt; &lt;option value="@{strength}"&gt;Strength&lt;/option&gt; &lt;option value="@{vigor}"&gt;Vigor&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; &lt;/div&gt; &lt;div class='sheet-col' style='width:193px; text-align:center;'&gt; &lt;input type="checkbox" name="attr_SkillEncumbrance" value="1" style="width:20px;" /&gt; &lt;/div&gt; &lt;div class='sheet-col' style='width:124px;'&gt; &lt;button type='roll' name='roll_SkillName' value='/em @{character_name} attempts to do something with @{SkillName} and rolls: [[{1d@{SkillNameRank}![@{SkillName}], 1d@{wilddie}![Wild Die]}kh1 + @{SkillNameMod}[Skill Modifiers] + @{ttmod}[Situational Modifiers] +(@{SkillEncumbrance}*@{encumbrance})[Encumbrance Penalty] - @{wounds}[Wounds] - @{fatigue}[Fatigue]]]!'&gt;&lt;/button&gt;&lt;button type='roll' class="sheet-GM-button" name='roll_gmSkillName' value='/w gm @{character_name} attempts to do something with @{SkillName} and rolls: [[{1d@{SkillNameRank}![@{SkillName}], 1d@{wilddie}![Wild Die]}kh1 + @{SkillNameMod}[Skill Modifiers] + @{ttmod}[Situational Modifiers] +(@{SkillEncumbrance}*@{encumbrance})[Encumbrance Penalty] - @{wounds}[Wounds] - @{fatigue}[Fatigue]]]!'&gt;&lt;/button&gt; &lt;input type='hidden' name='attr_rollSkill' value='/em @{character_name} attempts to do something with @{SkillName} and rolls: [[{1d@{SkillNameRank}![@{SkillName}], 1d@{wilddie}![Wild Die]}kh1 + @{SkillNameMod}[Skill Modifiers] + @{ttmod}[Situational Modifiers] +(@{SkillEncumbrance}*@{encumbrance})[Encumbrance Penalty] - @{wounds}[Wounds] - @{fatigue}[Fatigue]]]!' /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; And, in case it's important, here's the CSS: .sheet-dtypeOrig { width: 50px; display:inline; } .sheet-NewDieType:checked + *.sheet-dtypeOrig, .sheet-NewDieType:checked ~ [data-groupname=repeating_skills] &gt; .repitem .sheet-dtypeOrig { display: none; } .sheet-dtypedropdown { /* fixed widths work best;*/ width: 50px; display: none; } .sheet-dietype { display:inline-block; } .sheet-dietype { vertical-align: middle; width: 50px; height: 35px; } .sheet-dietype input, .sheet-dietype input + span { display:none; z-index: 1; } .sheet-dietype:hover { background: silver; opacity: .9; position:absolute; width: 50px; height: auto; z-index: 1; padding: 13px; } .sheet-dietype:hover &gt; .sheet-d4 { display: none; } .sheet-dietype:hover input , .sheet-dietype:hover input + span { display:inline; } .sheet-dietype:hover input + span { margin-right:10px; } .sheet-dietype:hover span { display: inline-block; } .sheet-d4 { /*background-position: -411px -1px;*/ width: 50px; height: 35px; /*background-image: url("<a href="https://i.imgur.com/zkgyBOi.png&quot;);*/" rel="nofollow">https://i.imgur.com/zkgyBOi.png");*/</a> font-family: "dicefontd4"; font-size: 50px; color: red; line-height:25px; text-align: right; display: none; } .sheet-d6 { /*background-position: -411px -1px;*/ width: 50px; height: 35px; /*background-image: url("<a href="https://i.imgur.com/zkgyBOi.png&quot;);*/" rel="nofollow">https://i.imgur.com/zkgyBOi.png");*/</a> font-family: "dicefontd6"; font-size: 40px; color: black; line-height:35px; text-align: right; display: inline-block; display: none; } .sheet-d8 { /*background-position: -703px -1px;*/ width: 50px; height: 35px; /*background-image: url("<a href="https://i.imgur.com/zkgyBOi.png&quot;);*/" rel="nofollow">https://i.imgur.com/zkgyBOi.png");*/</a> font-family: "dicefontd8"; font-size: 40px; color: black; line-height:35px; text-align: right; display: inline-block; display: none; } .sheet-d10 { /*background-position: -411px -1px;*/ width: 50px; height: 35px; /*background-image: url("<a href="https://i.imgur.com/zkgyBOi.png&quot;);*/" rel="nofollow">https://i.imgur.com/zkgyBOi.png");*/</a> font-family: "dicefontd10"; font-size: 45px; color: blue; line-height:35px; text-align: right; display: inline-block; display: none; } .sheet-d12 { /*background-position: -411px -1px;*/ width: 50px; height: 35px; /*background-image: url("<a href="https://i.imgur.com/zkgyBOi.png&quot;);*/" rel="nofollow">https://i.imgur.com/zkgyBOi.png");*/</a> font-family: "dicefontd12"; font-size: 40px; color: green; line-height:35px; text-align: right; display: inline-block; display: none; } .sheet-dietype:not(:hover) input[value="4"]:checked ~ .sheet-d4 { display: block; } .sheet-dietype:not(:hover) input[value="6"]:checked ~ .sheet-d6 { display: block; } .sheet-dietype:not(:hover) input[value="8"]:checked ~ .sheet-d8 { display: block; } .sheet-dietype:not(:hover) input[value="10"]:checked ~ .sheet-d10 { display: block; } .sheet-dietype:not(:hover) input[value="12"]:checked ~ .sheet-d12 { display: block; } .sheet-NewDieType:checked + *.sheet-dtypedropdown, .sheet-NewDieType:checked ~ [data-groupname=repeating_skills] &gt; .repitem .sheet-dtypedropdown { display:inline-block; } My Question(s) : Why will they update the same field if both are present? Only one type of menu is visible at any one time. And if I comment out one menu type and reload the page, they both access and update the same field properly (i.e. if the value is a d6, both types of menus will see that d6 and be able to change it if the other type is commented out), so why can't they both update as it's coded above? Is it possible to see somehow what all the different repeating section attributes are to see if the radio buttons are conflicting with one another? I don't think this is the case, since commenting out one type of menu allows either one to see, interact and update the value in the repeating_skills_0_SkillNameRank Attribute. Any other thoughts on how I might get this to work, or do I just need to abandon this effort for repeating sections? Thanks all.
1418712452
Lithl
Pro
Sheet Author
API Scripter
I believe the main problem is using &lt;select&gt;. As I recall, they don't work as autocalc fields, so I wouldn't be surprised if they don't synchronize properly with another field that has the same name. So you've got a radio button group saying 12 and a select saying 4, and the system is getting confused. You might try swapping their order in the HTML, hoping to capitalize on the later field having higher precedence. Of course, if selecting an option doesn't update the radio button group, you'd end up with the exact same problem, but it's something quick you could try.
1418723559
Finderski
Plus
Sheet Author
Compendium Curator
Thanks for the suggestion, Brian. I tried that this morning and it simply reversed the problem. :-/ The weird thing is that I use that exact same structure in other places on the character sheet and don't have any issues—only in the repeating section. Oh well. Thanks again for your help.