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 Needed] Hiding/Unhiding Elements within a fieldset

1435956066

Edited 1436003175
Finderski
Pro
Sheet Author
Compendium Curator
I'm trying to show/hide buttons depending on what's been selected elsewhere in the character sheet. This works in other areas, but for some reason in a new section of the character sheet it's not work. Here's the HTML: <input type="checkbox" class="sheet-buttonbox" name="attr_skillwrt" value="0" style="display: none;" /> <fieldset class="repeating_SShipWeapons"> <input type="text" style="width: 200px;" name="attr_SShipWeaponType" /> <input type="text" style="width: 85px;" name="attr_SShipWeaponRange" /> <input type="number" style="width: 40px;" name="attr_SShipWeaponRoF" /> <input type="number" name="attr_NoDmgDice" style="width: 35px;" value="2" /> <select name="attr_RDmgType" style="margin:0px;'"> <option value="d4!">d4</option> <option value="d6!">d6</option> <option value="d8!">d8</option> <option value="d10!">d10</option> <option value="d12!">d12</option> </select>+<input style="width: 35px;" type="number" name="attr_RDmgMod" value="0" style='margin:0px;' /> <input type="text" style="width: 210px;" name="attr_SShipWeaponPlacement" /> <input type='hidden' name='attr_rollSSRangeWeapon' value="[[@{NoDmgDice}@{RDmgType}+@{RDmgMod}[Weapon Damage]+@{dmgmod}[Damage Modifier]+@{RDmgRaise}[Bonus Damage]]]" /> <input type='hidden' name='attr_rolltSSRangeWeapon' value="{{name=@{character_name}}} {{weapon=@{SSWeaponType}}} {{damage_type=@{NoDmgDice}@{RDmgType}+@{RDmgMod}}} {{damage=@{rollSSRangeWeapon}}} {{raise=@{RDmgRaise}}} {{dmgmod=@{dmgmod}}}" /> <button class='sheet-templatebutton' type='roll' name='roll_tRangeWeapon' title="@{repeating_SShipWeapons_#_tRangeWeaponRoll}" value='@{skillwrt} @{rolltSSRangeWeapon}'></button><button type='roll' name='roll_tgmSSRangeWeaponRoll' title="@{repeating_SShipWeapons_#_tgmSSRangeWeaponRoll}" value='/w gm @{skillwrt} @{rolltRangeWeapon}'></button> <button class='sheet-normalbutton' type='roll' name='roll_rWeaponTypeRoll' title="@{repeating_SShipWeapons_#_rWeaponTypeRoll}" value='/em @{character_name} attempts to do damage with a @{SShipWeaponType} and rolls: @{rollSSRangeWeapon}!'></button><button type='roll' name='roll_gmrWeaponTypeRoll' title="@{repeating_SShipWeapons_#_gmrWeaponTypeRoll}" value='/w gm @{character_name} attempts to do damage with a @{SShipWeaponType} and rolls: @{rollRangeWeapon}!'></button> </fieldset> If the "sheet-buttonbox" class is checked, then I want to display the button with, but it is unchecked, I want to display the button with the Here's the CSS: .sheet-normalbutton, .sheet-templatebutton { display: none; } .sheet-buttonbox[value="0"]:checked ~ [data-groupname=repeating_SShipWeapons] > .repitem .sheet-normalbutton { display: inline-block; } .sheet-buttonbox[value="0"]:not(:checked) ~ [data-groupname=repeating_SShipWeapons] > .repitem .sheet-templatebutton { display: inline-block; } As I mentioned previously, that exact same format has worked before (and still works in the same sheet), but for some reason it's not working for this fieldset and I can't figure out why. Any help is appreciated.
1435958917
Kryx
Pro
Sheet Author
API Scripter
I don't see "sheet-buttonbox" in the code you put above besides the css. Nor do I see "data-groupname". The ">" selector is for immediate children. So unless "[data-groupname=repeating_SShipWeapons]" is the parent of the ".repitem" it isn't going to work.. Maybe I'm missing something..
1435968199
Finderski
Pro
Sheet Author
Compendium Curator
Mark said: I don't see "sheet-buttonbox" in the code you put above besides the css. Nor do I see "data-groupname". The ">" selector is for immediate children. So unless "[data-groupname=repeating_SShipWeapons]" is the parent of the ".repitem" it isn't going to work.. Maybe I'm missing something.. The class of "sheet-buttonbox" comes right before the name; not sure why the forum stripped it out... :-/ In all my other instances I've never had to call data-groupname, so how would I go about doing that? All of my other repeating sections follow the code above exactly (with the exception of the "name" values for the input fields and buttons. That's what I can't figure out, it all works for those other repeating sections, just not this one.
1435996535
Kryx
Pro
Sheet Author
API Scripter
if you don't use "data-groupname" anywhere then none of it should work. Think of "data-groupname" as something similar to "class". If you have css dependent on a class and that class isn't there it won't work. Can you please post the full html with the buttonbox? otherwise I can't tell you how to fix it as I don't know where "the name" is.
1436003419
Finderski
Pro
Sheet Author
Compendium Curator
Thanks for your help Mark. I've modified the above HTML to include the class names in the couple of places I found it missing. The full HTML for the sheet is over 5k lines, but if you want to see the whole thing let me know and I can put it up on Dropbox or something. Thanks again.
1436021809
Finderski
Pro
Sheet Author
Compendium Curator
UPDATE: I think I have resolved the issue...the fieldset was sharing a class name with a parent div. Once I changed the fieldset class name to something not remotely similar, the buttons appeared. Thanks for taking some time to look at this Mark. I'll let you know if I continue having problems, but right now, things are looking like they have been resolved.
1436036893
Kryx
Pro
Sheet Author
API Scripter
Glad to hear it. Sorry for the delayed response - I was on a boat today.
1436037358
Finderski
Pro
Sheet Author
Compendium Curator
LOL - no need to apologize. Looks like you made all you Boating rolls, so that's a good thing. ;)
1436043224

Edited 1436043248
Lithl
Pro
Sheet Author
API Scripter
Mark said: I don't see "sheet-buttonbox" in the code you put above besides the css. Nor do I see "data-groupname". The "&gt;" selector is for immediate children. So unless "[data-groupname=repeating_SShipWeapons]" is the parent of the ".repitem" it isn't going to work.. Maybe I'm missing something.. data-groupname is automatically generated for repeating sections, with a value equal to the class name of the fieldset used in the original code. There will be two divs with the appropriate data-groupname: one containing all of the repeating items, and one containing the add/modify buttons. Similarly, there will be a div.repitem for each item in the repeating section as the immediate child of the first div with data-groupname. See here for the structure of a repeating section: <a href="https://app.roll20.net/forum/post/882997/#post-923" rel="nofollow">https://app.roll20.net/forum/post/882997/#post-923</a>...