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 .
×

Problems with buttons inside repeating sections

1593249830

Edited 1593249861
Hello, first time character sheet author here, and I'm working on adding another DCC sheet option to Roll20.&nbsp; Specifically, one that can manage multiple characters at once, rather than a single character (primary to facilitate funnels). In my current iteration of the sheet, I'm putting basically everything inside a repeated section; each character is going to be a single entry in the section.&nbsp; So this means that every attribute and action button is effectively inside the "repeating_heroes" section. Within each sheet, I wanted to have a row of buttons that allow you to switch between different views of the sheet.&nbsp; Here's the snippet: &lt;div class="hero-details"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-buttons"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class="details-button" type="action" name="act_selectLevel0"&gt;Level 0&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class="details-button" type="action" name="act_selectInventory"&gt;Inventory&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class="details-button" type="action" name="act_selectStatus"&gt;Status&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class="details-button" type="action" name="act_selectAbilities"&gt;Abilities&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class="details-button" type="action" name="act_selectSpellcasting"&gt;Spellcasting&lt;/button&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class="toggle" type="hidden" name="attr_selectLevel0"/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-content"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="level_zero"&gt;LEVEL 0 PLACEHOLDER&lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class="toggle" type="hidden" name="attr_selectInventory"/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-content"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="inventory"&gt;INVENTORY PLACEHOLDER&lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class="toggle" type="hidden" name="attr_selectStatus"/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-content"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="status"&gt;STATUS PLACEHOLDER&lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class="toggle" type="hidden" name="attr_selectAbilities"/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-content"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="abilities"&gt;ABILITIES PLACEHOLDER&lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class="toggle" type="hidden" name="attr_selectSpellcasting"/&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="hero-details-content"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div class="spells"&gt;SPELLCASTING PLACEHOLDER&lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt; And here's the associated javascript: &lt;script type="text/worker"&gt; on("clicked:repeating_heroes:selectLevel0", function() { console.log("Clicked Level 0"); setAttrs({ repeating_heroes_selectLevel0: true, repeating_heroes_selectInventory: false, repeating_heroes_selectStatus: false, repeating_heroes_selectAbilities: false, repeating_heroes_selectSpellcasting: false }); }); on("clicked:repeating_heroes:selectInventory", function() { console.log("Clicked Inventory"); setAttrs({ repeating_heroes_selectLevel0: false, repeating_heroes_selectInventory: true, repeating_heroes_selectStatus: false, repeating_heroes_selectAbilities: false, repeating_heroes_selectSpellcasting: false }); }); on("clicked:repeating_heroes:selectStatus", function() { console.log("Clicked Status"); setAttrs({ repeating_heroes_selectLevel0: false, repeating_heroes_selectInventory: false, repeating_heroes_selectStatus: true, repeating_heroes_selectAbilities: false, repeating_heroes_selectSpellcasting: false }); }); on("clicked:repeating_heroes:selectAbilities", function() { console.log("Clicked Abilities"); setAttrs({ repeating_heroes_selectLevel0: false, repeating_heroes_selectInventory: false, repeating_heroes_selectStatus: false, repeating_heroes_selectAbilities: true, repeating_heroes_selectSpellcasting: false }); }); on("clicked:repeating_heroes:selectSpellcasting", function() { console.log("Clicked Spellcasting"); setAttrs({ repeating_heroes_selectLevel0: false, repeating_heroes_selectInventory: false, repeating_heroes_selectStatus: false, repeating_heroes_selectAbilities: false, repeating_heroes_selectSpellcasting: true }); }); &lt;/script&gt; Whenever I click the buttons, however, I'm not even seeing my messages log to the console, so the listeners clearly aren't even firing in the first place (I'm not seeing any errors in the console either).&nbsp; I did see a similar question posted here:&nbsp; <a href="https://app.roll20.net/forum/post/7320330/on-clicked-action-button-and-repeating-sections" rel="nofollow">https://app.roll20.net/forum/post/7320330/on-clicked-action-button-and-repeating-sections</a> .&nbsp; But the resolution on that thread seemed to be that yes, buttons in repeating sections are supported.&nbsp; And I'm not doing either of the things mentioned in that thread to cause issues with the buttons (no underscores in the names, and no positional styling anywhere in the sheet). I'm a little stumped at this point, so I wanted to post here to see if anyone else has an idea what I'm doing wrong.&nbsp; Is there something I missed?&nbsp; Has there maybe been a regression such that buttons no longer work in repeated sections?
1593257886

Edited 1593257992
Finderski
Pro
Sheet Author
Compendium Curator
I'm not seeing a fieldset anywhere...is that above the hero-details div?&nbsp;
Yeah, it's at the very top of the html.&nbsp; Here's the snippet for that part: &lt;div class="root"&gt;&lt;span class="header"&gt;Heroes&lt;/span&gt; &lt;fieldset class="repeating_heroes"&gt; &lt;div class="hero"&gt; &lt;div class="hero-name"&gt;&lt;span class="block-label"&gt;Name&lt;/span&gt; &lt;input type="text" name="attr_name" value=""/&gt; &lt;/div&gt; &lt;div class="hero-occupation"&gt;&lt;span class="block-label"&gt;Occupation&lt;/span&gt; &lt;input type="text" name="attr_occupation" value=""/&gt; &lt;/div&gt; &lt;div class="hero-class"&gt;&lt;span class="block-label"&gt;Class&lt;/span&gt; &lt;input type="text" name="attr_class" value="Peasant"/&gt; &lt;/div&gt; ... Sorry bout that, the fieldset is pretty far from the buttons in the file.&nbsp; Didn't think to copy the above in as well when I wrote the original post.
1593275835
GiGs
Pro
Sheet Author
API Scripter
action buttons are supported in a repeating section, but not as smoothly as attributes. They dont automatically get the row id, so you need supply it. The easiest way is to use event info. Also there's a lot of duplication in your worker - since we are using eventinfo to get the id, we can also get the specific button that was pressed. The fact that you've used the same name for the action buttons and the attribute makes this very easy. on('clicked:repeating_heroes',&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;fields&nbsp;=&nbsp;['selectLevel0',&nbsp;'selectInventory',&nbsp;'selectStatus',&nbsp;'selectAbilities',&nbsp;'selectSpellcasting']; &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;trigger&nbsp;=&nbsp;eventInfo.previousAttribute.split('_'); &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;rowid&nbsp;=&nbsp;trigger[2]; &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;thisfield&nbsp;=&nbsp;trigger[3]; &nbsp;&nbsp;&nbsp;&nbsp;console.log('Clicked&nbsp;'&nbsp;+&nbsp;thisfield); &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;output&nbsp;=&nbsp;{}; &nbsp;&nbsp;&nbsp;&nbsp;fields.forEach(field&nbsp;=&gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output['repeating_heroes_'&nbsp;+&nbsp;rowid&nbsp;+&nbsp;'_'&nbsp;+&nbsp;field]&nbsp;=&nbsp;false; &nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;output['repeating_heroes_'&nbsp;+&nbsp;rowid&nbsp;+&nbsp;'_'&nbsp;+&nbsp;thisfield]&nbsp;=&nbsp;true; &nbsp;&nbsp;&nbsp;&nbsp;setAttrs(output); });
1593324317

Edited 1593324415
Thanks for the responses! Yeah, I initially had it all handled in a single function, but when I couldn't figure out what wasn't working, I started dumbing down the code quite a bit to help me debug. Unfortunately, it still doesn't look like things are working as intended though.&nbsp; 'previousAttribute' doesn't appear to be a field on eventInfo.&nbsp; So I tried logging the eventInfo object to see if it was just a typo, and here's an example of what I got: { sourceAttribute: "repeating_heroes_-MAeZvgfAT8OYZBbcxGM", sourceType: undefined, triggerName: "clicked:repeating_heroes_-maezvgfat8oyzbbcxgm" } I'm guessing sourceAttribute is normally what I'd want, given that triggerName is forcing all characters to lowercase (I do recall that being mentioned somewhere in the wiki). But in any case, that's what I get for clicking any of the buttons.&nbsp; So I can tell that a &nbsp;button was clicked, but not which one. It also seems like the documentation is out-of-date?&nbsp; This help center article definitely doesn't list the same fields for the eventInfo object as what I'm observing:&nbsp; <a href="https://roll20.zendesk.com/hc/en-us/articles/360037773513-Sheet-Worker-Scripts#eventinfo-object-0-4" rel="nofollow">https://roll20.zendesk.com/hc/en-us/articles/360037773513-Sheet-Worker-Scripts#eventinfo-object-0-4</a> .&nbsp; Most notably, triggerName doesn't appear to be documented, and I'm missing three other fields. Is there another, more accurate source of documentation for this API and the rest of the Roll20 character sheet framework?&nbsp; I'll admit, I've been using the deprecated wiki instead of the zendesk articles for the most part, mostly because the layout helps me digest the information more efficiently.&nbsp; But until now, I don't think I'd hit any issues with the wiki's info being out of date.&nbsp; And in this case, it looks like both the wiki and zendesk have the same info.
1593328396
GiGs
Pro
Sheet Author
API Scripter
Oops, yes, that should have been sourceAttribute . Looks like tonight is my night for sloppy mistakes, lol. triggerName is a fairly recent addition, added for support of action buttons. But funnily enough, sourceAttribute works better for this purpose. However, testing this code has revealed a couple of issues with action buttons. It looks like you cant use this syntax: 'clicked:repeating_heroes' you have to use 'clicked:repeating_heroes:selectinventory' otherwise it doesn't supply the fieldname at the end. Which is weird. The second issue is that the action button names must be in all lower case - both in the sheet worker, and in the html. So you have to change the buttons at the start to &nbsp;&nbsp;&nbsp;&nbsp; &lt;button&nbsp;class="details-button"&nbsp;type="action"&nbsp;name="act_selectlevel0"&gt;Level&nbsp;0&lt;/button&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;button&nbsp;class="details-button"&nbsp;type="action"&nbsp;name="act_selectinventory"&gt;Inventory&lt;/button&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;button&nbsp;class="details-button"&nbsp;type="action"&nbsp;name="act_selectstatus"&gt;Status&lt;/button&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;button&nbsp;class="details-button"&nbsp;type="action"&nbsp;name="act_selectabilities"&gt;Abilities&lt;/button&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;button&nbsp;class="details-button"&nbsp;type="action"&nbsp;name="act_selectspellcasting"&gt;Spellcasting&lt;/button&gt; The sheet worker would be slightly reorganised: &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;fields&nbsp;=&nbsp;['selectlevel0',&nbsp;'selectinventory',&nbsp;'selectstatus',&nbsp;'selectabilities',&nbsp;'selectspellcasting']; &nbsp;&nbsp;&nbsp;&nbsp;on(fields.map(field&nbsp;=&gt;&nbsp;`clicked:repeating_heroes:${field}`).join('&nbsp;'),&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;trigger&nbsp;=&nbsp;eventInfo.triggerName.split('_'); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;rowid&nbsp;=&nbsp;trigger[2]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;thisfield&nbsp;=&nbsp;trigger[3]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;output&nbsp;=&nbsp;{}; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fields.forEach(field&nbsp;=&gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output['repeating_heroes_'&nbsp;+&nbsp;rowid&nbsp;+&nbsp;'_'&nbsp;+&nbsp;field]&nbsp;=&nbsp;false; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output['repeating_heroes_'&nbsp;+&nbsp;rowid&nbsp;+&nbsp;'_'&nbsp;+&nbsp;thisfield]&nbsp;=&nbsp;true; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs(output); &nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp; That fields.map section at the start takes the array of names, and created a set of clicked:fullbuttonnames, &nbsp;so you dont have to manually type them all out. So, this should fix the sheet worker. But while examining it I realised there might be a deeper problem. Are these buttons actually inside your repeating section? If so, they'll appear on every row of the section which is a bit overkill. They can be outside of the section, and almost certainly should be. Though that would need slightly different code.
1593328480
GiGs
Pro
Sheet Author
API Scripter
Eric R. said: Is there another, more accurate source of documentation for this API and the rest of the Roll20 character sheet framework?&nbsp; I'll admit, I've been using the deprecated wiki instead of the zendesk articles for the most part, mostly because the layout helps me digest the information more efficiently.&nbsp; But until now, I don't think I'd hit any issues with the wiki's info being out of date.&nbsp; And in this case, it looks like both the wiki and zendesk have the same info. The wiki is the best source of information, generally. It's updated by the community, so anything that gets put in zendesk will appear in the wiki soon after, but the reverse isnt true. That means the wiki will always be the most comprehensive source.
1593329430
GiGs
Pro
Sheet Author
API Scripter
If you move the buttons out of the repeating section, this code will update all the hidden boxes in every row as appropriate: &nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;fields&nbsp;=&nbsp;['selectlevel0',&nbsp;'selectinventory',&nbsp;'selectstatus',&nbsp;'selectabilities',&nbsp;'selectspellcasting']; &nbsp;&nbsp;&nbsp;&nbsp;on(fields.map(field&nbsp;=&gt;&nbsp;`clicked:${field}`).join('&nbsp;'),&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;trigger&nbsp;=&nbsp;eventInfo.triggerName.split(':')[1]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;output&nbsp;=&nbsp;{}; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getSectionIDs('repeating_heroes',&nbsp;idArray&nbsp;=&gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idArray.forEach(id&nbsp;=&gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fields.forEach(field&nbsp;=&gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output['repeating_heroes_'&nbsp;+&nbsp;id&nbsp;+&nbsp;'_'&nbsp;+&nbsp;field]&nbsp;=&nbsp;(field&nbsp;===&nbsp;trigger)&nbsp;?&nbsp;true&nbsp;:&nbsp;false; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs(output); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;});&nbsp;&nbsp;&nbsp;&nbsp; Remember to reduce all the button names to lower case. Note: in another bit of roll20 weirdness, triggerName must be used over sourceAttribute. For some reason sourceAttribute can give you the button's attribute name when used inside a repeating section (as long as you supply it in the clinked: part), but doesnt seem to for non-repeating attributes.
So, this should fix the sheet worker. But while examining it I realised there might be a deeper problem. Are these buttons actually inside your repeating section? If so, they'll appear on every row of the section which is a bit overkill. They can be outside of the section, and almost certainly should be. Though that would need slightly different code. Yes, they are inside the repeated section.&nbsp; But mainly because everything is in a repeated section.&nbsp; I'm not sure if there's precedence for this in any existing sheets for other games, but my goal is to be able to manage multiple characters from one sheet.&nbsp; For DCC funnels, you generally run with ~4 level 0 characters per person, and I wanted to create a sheet that could facilitate this well.&nbsp; There are a couple other sheets for DCC already on here that look great, but trying to assign 4 different full-page character sheets to each player can get to be a little rough to manage.&nbsp; Not sure if you've ever played it before, but here's an example of what you'd see for a paper sheet for a DCC funnel:&nbsp; <a href="https://purplesorcerer.com/create.php?oc=rulebook&amp;mode=3d6&amp;stats=&amp;abLow=Any&amp;abHigh=Any&amp;hp=normal&amp;at=normal&amp;display=PDF&amp;sc=1" rel="nofollow">https://purplesorcerer.com/create.php?oc=rulebook&amp;mode=3d6&amp;stats=&amp;abLow=Any&amp;abHigh=Any&amp;hp=normal&amp;at=normal&amp;display=PDF&amp;sc=1</a> And here's a screenshot of what I've built so far to try to emulate this:&nbsp; <a href="https://imgur.com/eRmKUOE" rel="nofollow">https://imgur.com/eRmKUOE</a> The 'details' check box expands the sheet to reveal those buttons.&nbsp; The buttons are then used to display the different components of the sheet.&nbsp; I'm hoping that this way I can keep everything compact and easy to navigate. This is actually my second version.&nbsp; The first version statically defined 4 different character sheets that you could switch between using tabs at the top.&nbsp; But I wasn't a fan of how it worked, and it wasn't as flexible as I wanted it to be (e.g. one of my players lost 3 of their 4 characters early on, so I wanted to toss them an extra NPC midway through the funnel.&nbsp; But the first version of my sheet wouldn't let me just add another character).
1593330140

Edited 1593330510
But thank you so much for the help!&nbsp; You're latest suggestion appears to be working fantastically.&nbsp; FYI, I still had to use the sourceAttribute field instead of the triggerName field, since triggerName sets the whole rowid to lowercase.&nbsp; But it's working exactly how I wanted it to now. Weird quirk that the buttons need to be all lowercase.&nbsp; I'm guessing it's the entire triggerName being forced to lowercase, not just the rowid, so that's why the listener wasn't matching properly. EDIT: I played around with it a little more, and it actually seems like the rowid isn't necessary to set the attributes correctly: const fields = ['selectlevel0', 'selectinventory', 'selectstatus', 'selectabilities', 'selectspellcasting']; on(fields.map(f =&gt; `clicked:repeating_heroes:${f}`).join(' '), function(eventInfo) { const trigger = eventInfo.sourceAttribute.split('_'); const thisfield = trigger[3]; const output = {}; fields.forEach(f =&gt; { output['repeating_heroes_' + f] = false; }); output['repeating_heroes_' + thisfield] = true; setAttrs(output); }); The above works as well.&nbsp; Another reason I wanted the buttons in the repeated section instead of outside was so that I could have 2 character sheets expanded, and be able to navigate different sections in each sheet (e.g. display the inventory on the first sheet, and abilities on the second).&nbsp; And it looks like that still works without needing to reference the row IDs (I'm guessing because the listener is firing inside the repeated section). Thanks again!&nbsp; And good to know that I can stick with the wiki and expect to have the most comprehensive info.
1593330389
GiGs
Pro
Sheet Author
API Scripter
i see, I didnt grasp what you were doing. So you have two choices: If you use the buttons inside the repeating section, you get the functionality you want, with each row's button independent of the others, If you use the code in my last post, though, they could be a benefit: when someone clicks the Inventory button, it will switch all charaacter's to the inventory view. When they switch to Abilities, all the characters will switch to Abilities. This is probably better for the players. With this approach, you dont have the buttons inside the repeating section. You could have a wider title for each subsection.
1593330563
GiGs
Pro
Sheet Author
API Scripter
Eric R. said: But thank you so much for the help!&nbsp; You're latest suggestion appears to be working fantastically.&nbsp; FYI, I still had to use the sourceAttribute field instead of the triggerName field, since triggerName sets the whole rowid to lowercase.&nbsp; But it's working exactly how I wanted it to now. Weird quirk that the buttons need to be all lowercase.&nbsp; I'm guessing it's the entire triggerName being forced to lowercase, not just the rowid, so that's why the listener wasn't matching properly. Ah yes, that's a flaw with triggerName, which is why I prefer to use sourceAttribute inside repeatingSections. If you use console.Log to look at the output of triggername, vs sourceAttribute, you'll see sourceAttribute respects the true case, but triggerName coerces the rowid to lower case.
If you use the code in my last post, though, they could be a benefit: when someone clicks the Inventory button, it will switch all charaacter's to the inventory view. When they switch to Abilities, all the characters will switch to Abilities. Interesting suggestion, I'll have to keep that in mind while I'm testing it out.&nbsp; I actually have a group that I'm running DCC for right now (potentially a second), so I might try both approaches out with the players and see what people prefer.
1593330730
GiGs
Pro
Sheet Author
API Scripter
Eric R. said: EDIT: I played around with it a little more, and it actually seems like the rowid isn't necessary to set the attributes correctly : The above works as well.&nbsp; Another reason I wanted the buttons in the repeated section instead of outside was so that I could have 2 character sheets expanded, and be able to navigate different sections in each sheet (e.g. display the inventory on the first sheet, and abilities on the second).&nbsp; And it looks like that still works without needing to reference the row IDs ( I'm guessing because the listener is firing inside the repeated section ). That makes sense. Attributes dont need the row id when fired within the repeating section. I was so focussed on solving the problem with action buttons, where that's not true, I forgot that.
No worries, I've been there before, believe me ;)&nbsp; I just appreciate you being so responsive and helping me get to the bottom of this!
1593330960
GiGs
Pro
Sheet Author
API Scripter
Glad to help. :)