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

[HELP] Duplicating/Linked Radio buttons across multiple tabs

1587925350
Peter B.
Pro
Sheet Author
Hello Roll20 Pros! The Problem Does anyone have a good solution to duplication a group of radio buttons? In my character sheet I have two tabs, and I would like values to work across each tab. The data is something like this &lt;div class="sheet-tab-content sheet-section-weapon-standard-melee"&gt; &lt;!-- Checkbox and input works fine --&gt; &lt;input type='checkbox' name='attr_strbonus' title="@{strbonus}" value='1' checked/&gt; &lt;input type="text" name="attr_weaponname" title="@{weaponname}" class="sheet-middle"&gt; &lt;!-- Radio buttons create problems --&gt; &lt;input type="radio" name="attr_range-mod-attack" value="0" checked/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-2"/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-5"/&gt; &lt;/div&gt; &lt;div class="sheet-tab-content sheet-section-weapon-player-option-melee"&gt; &lt;!-- Checkbox and input works fine --&gt; &lt;input type='checkbox' name='attr_strbonus' title="@{strbonus}" value='1' checked/&gt; &lt;input type="text" name="attr_weaponname" title="@{weaponname}" class="sheet-middle"&gt; &lt;!-- Radio buttons create problems --&gt; &lt;input type="radio" name="attr_range-mod-attack" value="0" checked/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-2"/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-5"/&gt; &lt;/div&gt; I would like the sheet to work such as if a player changes the value on one tab, and then changes to another tab, then the same value will be chosen on the currently viewed tab. So in this case if a player on the Standard tab changes the value from 0 to -2, and then changes to the player option tab, then I would like the chosen value on the new tab to also be -2. I understand why Radio buttons, in the configuration I just made above, do not work as I intend. By design only a single value can be selected from a radio button group. And by giving all of the buttons the same name attribute they are considered to be in the same group so therefore only one of the 6 can be chosen at a time. If I change the radio buttons to to be two different groups, by changing the name attribute, then they are not the same group and therefore will not be linked. It would look something like this: &lt;div class="sheet-tab-content sheet-section-weapon-standard-melee"&gt; &lt;!-- Radio buttons create problems --&gt; &lt;input type="radio" name="attr_range-mod-attack" value="0" checked/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-2"/&gt; &lt;input type="radio" name="attr_range-mod-attack" value="-5"/&gt; &lt;/div&gt; &lt;div class="sheet-tab-content sheet-section-weapon-player-option-melee"&gt; &lt;!-- Radio buttons create problems --&gt; &lt;input type="radio" name="attr_range-mod-attack2" value="0" checked/&gt; &lt;input type="radio" name="attr_range-mod-attack2" value="-2"/&gt; &lt;input type="radio" name="attr_range-mod-attack2" value="-5"/&gt; &lt;/div&gt; The solution? I am not interested in any solution that changes the radio buttons to checkboxes, as that would allow a player to select multiple values, which is not what I want. I want to limit the player to only select a single value. Is there a way to use a SheetWorker in some way to update one group of radio buttons, when another is changed and vice versa? I have not worked with SheetWorkers up until now, but it sounds like something made specifically for a purpose like this. I would prefer if any solution would also work with repeating fields, as I would like the player to be able to add multiple rows of weapons, and I would like each row in each table to be linked, in which I mean tab Standard-repeating row 1's radio buttons are linked with tab Player Option-repeating row 1's radio buttons. I don't know if this is entirely impossible as I have noticed that radio buttons are getting a new value when placed in a repeating row: &lt;input type="radio" name="attr_-M5qGhnZreCJilm3Gk9o_repeating_weapons2_range-mod-attack" data-attrname =" range-mod-attack " &gt; In this case I don't know if it is the name tag or the data-attrname tag that is read. Looking at the forum I found this:&nbsp; <a href="https://app.roll20.net/forum/post/2495912/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/2495912/slug%7D</a> &nbsp;which didn't really help. Any clearification is helpful!
You could try making them dropdown selects with the same attribute name instead of radio buttons. I have used this on my custom sheet. All attributes within a repeating section get the section's SectionID added to them to make them unique across the character. You can refer to attributes from outside a repeating section within a repeating section, but getting values from other repeating sections I am not sure about. Can you briefly explain the use case for what these values need to do?
1587968419

Edited 1587975388
Peter B.
Pro
Sheet Author
Rabulias said: You could try making them dropdown selects with the same attribute name instead of radio buttons. I have used this on my custom sheet. All attributes within a repeating section get the section's SectionID added to them to make them unique across the character. You can refer to attributes from outside a repeating section within a repeating section, but getting values from other repeating sections I am not sure about. Can you briefly explain the use case for what these values need to do? Thank you for the tip. The sheet looks like this: I have been using dropdowns for the problem of letting the player select their proficiency level. It works great here, and I like it. In the use case I am talking about I want the player to select their Range Modifier. In this case I prefer radio buttons for two reasons: Only a single value can be selected. It makes no sense for a player to select multiple ranges because an enemy is only ever in a single range. This value tends to change more frequenctly therefore Radio buttons seems more fitting and the player can quickly change the value from Long to Medium to Short as the enemy comes closer towards them. I do realize that the same can be achieve with a dropdown, but I would really prefer a radio button in this case, simply because they are faster and more clearly show what value is currently chosen.
1587968959

Edited 1587969710
Wouldn't the range only come into play when the missile weapon is fired or thrown? I would suggest to prompt the user for the range via a roll query in the ranged weapon's macro, and do the math to generate the modifier there. That way, the players (and the DM) don't need to keep opening their sheets during to combat to adjust range. I have the Range Increment and Max Range as attributes for each ranged weapon on my custom sheer, and it's -2 per range increment beyond the first. This is D&amp;D 3.5; I forget what the rules are for AD&amp;D, but you can probably adapt this. Macro code excerpt: - [[floor(?{Range (in feet) (Max range = @{rwpn_range|max} ft)|0}/@{rwpn_range})*2]] [Range]
1587970581
GiGs
Pro
Sheet Author
API Scripter
Generally you dont want modifiers that apply per action to be on the character sheet. That requires players to remember to uncheck them (or pick a new one) every time time they make an action, and as Rabulias says, they must have the character sheet open to do that. In roll20, players have a lot of freedom in how to trigger their sheet buttons. They can make them abilities, turn them into token actions, or add them to a chat menu button. Making them enter something on the character sheet every time they use the skill or ability robs them them of that flexibility.
1587975351
Peter B.
Pro
Sheet Author
GiGs said: Generally you dont want modifiers that apply per action to be on the character sheet. That requires players to remember to uncheck them (or pick a new one) every time time they make an action, and as Rabulias says, they must have the character sheet open to do that. In roll20, players have a lot of freedom in how to trigger their sheet buttons. They can make them abilities, turn them into token actions, or add them to a chat menu button. Making them enter something on the character sheet every time they use the skill or ability robs them them of that flexibility. Thank you for your input! I am not "inventing" something new here. I am trying to improve what was already present. The current sheet has a row of checkboxes on the sheet, with the current functionality. All I want to do is change the type from Checkboxes to Radio buttons, while maintaining the shared value across the two tabs. I am new to Roll20 myself, so I have no idea how to do all the things you are describing (abilities, token actions, chat menu buttons). Therefore I have not used them. When I have been playing, I have had the character sheet open on one screen and the game open on another. That has worked for me so far. Please do not misunderstand me, I am not against your approach! I prefer small incremental changes to the character sheet, and this would be such a small change, removing a bit of errorous inputs from the current sheet, by only allowing a single value to be chosen instead of multiple.
1587997421

Edited 1588000373
Incremental change is often good, but if you make any changes to these attributes, you will need to update the macro as well. If you later shift to our suggested (or another) method of implementing range, you will need to change the attribute names and the macro again. I would suggest that in this case, one big change to a better, final form, would be better than two incremental changes. That way, players and DMs only have to adjust to the new names and macros once instead of twice. Another suggestion: Whatever you decide (assuming you are planning to submit your changes to the Roll20 repo), you may want to first update the sheet code to include a dismissable note that will display to users of the sheet alerting them to the changes coming. Push this change to the Roll20 github repo, and leave it for a couple of weeks before pushing any other changes. You can review the code for the GURPS character sheet; they make good use of this in their regular updates. You could even include a link to this thread (or another) for more info. Most users probably do not use the Forums, so this will keep them from being surprised. You can also set up an open and public game for people to log in and test out the sheet. Welcome to Roll20 sheet editing. It is fun, crazy, and addictive! EDIT: My first paragraph is also assuming you are planning to publish the sheet to the repo. If you are just doing this for your personal use, then you can ignore me . ;-)
1588002710
Peter B.
Pro
Sheet Author
Rabulias said: Incremental change is often good, but if you make any changes to these attributes, you will need to update the macro as well. If you later shift to our suggested (or another) method of implementing range, you will need to change the attribute names and the macro again. I would suggest that in this case, one big change to a better, final form, would be better than two incremental changes. That way, players and DMs only have to adjust to the new names and macros once instead of twice. Another suggestion: Whatever you decide (assuming you are planning to submit your changes to the Roll20 repo), you may want to first update the sheet code to include a dismissable note that will display to users of the sheet alerting them to the changes coming. Push this change to the Roll20 github repo, and leave it for a couple of weeks before pushing any other changes. You can review the code for the GURPS character sheet; they make good use of this in their regular updates. You could even include a link to this thread (or another) for more info. Most users probably do not use the Forums, so this will keep them from being surprised. You can also set up an open and public game for people to log in and test out the sheet. Welcome to Roll20 sheet editing. It is fun, crazy, and addictive! EDIT: My first paragraph is also assuming you are planning to publish the sheet to the repo. If you are just doing this for your personal use, then you can ignore me . ;-) I am planning to post to the Repo :) Could you please elaborate on what you mean by GURPS character sheet? I am unaware of that accronym. The other times I have updated a character sheet, I have done it by posting a thread on the forum for people to review the changes and then letting the changes go online after a couple of weeks, if there have been no interventions.
Peter B. said: Could you please elaborate on what you mean by GURPS character sheet? I am unaware of that accronym. GURPS is Steve Jackson Games' Generic Universal Role Playing System. You can see the code in the repo here: <a href="https://github.com/Roll20/roll20-character-sheets/tree/master/GURPS" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/tree/master/GURPS</a> I have learned a lot from other sheets, even systems very unlike D&amp;D, as there are CSS or HTML techniques that I could adapt. You can always start a new game in Roll20, pick a different character sheet (like GURPS) from the dropdown list, launch the game, create a character, and play around with the sheet. If you find something you like, grab the HTML and CSS from the repo to see how they did it. When you are done, or don't find anything useful on the sheet, you can exit and then delete the game.