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] Repeating Section feeding into selector

On my sheet I am working on two tabs: A "Weapons" tab, where players can set up and configure what weapons to which their character has access, and a "Dashboard" tab, that brings most common player actions onto the same tab so they don't have to jump around the sheet. I would like the "Weapons" section to be a repeating section, but I'm trying to figure out how to then make main- and off-hand selectable on the Dashboard tab.  Ideally I'd be able to use a select list (even if it says "Weapon 1" instead of "Dagger +1", as I can use scripts to fill in the weapon data on the Dashboard) to minimize the amount of screen real estate the selector occupies. Does anyone have any ideas?
1524152374
Natha
KS Backer
Sheet Author
API Scripter
AFAIK, there's no way to create DOM elements (OPTIONs in the SELECT) in Roll20 character sheet (wherever the data source comes from, repeating section or not).
1524154617
Jakob
Sheet Author
API Scripter
You can use a fake select populated with another copy of the repeating_weapon (or whatever your section is named) section. Basically a variant of  this , where you style the summary to act similarly to a select via CSS.
I have no idea how to rebuild a select via CSS... at least not without getting bonkers complicated.  I guess I'd expand a div with a higher z-order on :active on the fake select window, populate the div with the repeating section options, and set the value of the fake select via sheetworker?
1524164068
Jakob
Sheet Author
API Scripter
Charles H. said: I have no idea how to rebuild a select via CSS... at least not without getting bonkers complicated.  I guess I'd expand a div with a higher z-order on :active on the fake select window, populate the div with the repeating section options, and set the value of the fake select via sheetworker? Yes, something like that (using :hover on the wrapper div). There's an example on the wiki, but it wouldn't work for your case, since the height is not fixed, and it's also somewhat weirdly written. I'll see if I can cobble together a minimal example some time later.
1524206859

Edited 1524206921
Jakob
Sheet Author
API Scripter
Something like this: <div class="sheet-fake-select">   <div>     <span name="attr_chosen_weapon"></span>   </div>   <fieldset class="repeating_weapons">     <label>       <input type="checkbox" name="attr_weapon_chosen" value="1">       <span name="attr_weapon_name"></span>     </label>   </fieldset> </div> CSS (it's probably  the case I forgot something essential here, but you can hopefully cobble together the rest): .sheet-fake-select { height: 20px; /*whatever the height of exactly one line is */ position: relative; z-index: 5; } .sheet-fake-select .repcontrol { display: none; } .sheet-fake-select:not(:hover) .repcontainer { display: none; } .sheet-fake-select:hover > :first-child { display: none; } + style the .repitems and labels and inputs and spans so that they actually look right for you. (including having a solid background) + some sheetworkers to set "chosen_weapon" to whatever the currently chosen weapon is, and make sure a maximum of one weapon can be selected. Hope that helps.
1524215061

Edited 1524215521
Natha
KS Backer
Sheet Author
API Scripter
Jakob said: Something like this: (...) Nice! EDIT: stupid question.
Thanks for the help on this. :)  I'm hoping to have time to circle back to sheet on Sunday.