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

Roll Button In Fieldset Won't Work For Me --- Gives Me an Uncaught Type Error?

1552994189

Edited 1553007268
I have a roll button inside a fieldset, which I can't get to work.  Even when I replace the button command with a simple slash command, I get an uncaught type error in my console and nothing is sent to chat. After testing, I can confirm that the code works if I simply remove the fieldset tags, so there's something being introduced by the fieldset that is causing the problem. Here is the relevant section of my test code, with the actual button commented out and replaced with a simple test command:  < fieldset class = "repeating_combatentry sheet-combatentry" > < div class = "sheet-gridcontainer" > <!-- ... other code removed; nothing references any of the attributes below --> </ div > < div class = "sheet-buttoncontrol" > <!-- <button type="roll" class="sheet-top" name="roll_hitroll" value="!hitroll @{hitrollparams}"></button> --> < button type = "roll" name = "roll_check" value = "/em Testing" ></ button > < input type = "hidden" name = "attr_hitrollparams" value = "" > </ div > </ fieldset > And here is the error I get in the console whenever I click the button: Any help would be greatly appreciated!
1553003540

Edited 1553003566
vÍnce
Pro
Sheet Author
Try only one fieldset name.  ie class="repeating_foo"
1553007122

Edited 1553007231
Vince said: Try only one fieldset name.  ie class="repeating_foo" Alas, that didn't work; the same error occurs when the fieldset class is only "repeating_combatentry".  Thanks for the suggestion though, I hadn't considered that might have been the problem! It did give me the idea to test the button outside of the fieldset --- and when I do that, it works!  So there's something going on with the fieldset interaction.
1553013457
GiGs
Pro
Sheet Author
API Scripter
I cant see anything there that would be a problem (you can have multiple classes alongside repeating_). Often in coding when you have a weird error that doesnt make sense, there is something going wrong before the place the error occurs. Try moving the entire fieldset to very top of the html page, for testing, and see if the error still happens. If so, try deleting everything else in the character sheet (make a copy) except the fieldset and see if it still happens. And if that doesnt work, try creating a completely new campaign, put the fieldset code as the character sheet, and see if the error happens? If only the latter works, I'd copy your code over to the new campaign - you may have a weird corruption issue in your campaign.
1553013770
GiGs
Pro
Sheet Author
API Scripter
I just created a campaign with just the fieldset code copied from above, and the button worked fine.
Thank you very much!  Your suggestions helped me narrow down the issue:  Apparently, a <select> element in a completely different <div> within the fieldset was causing problems because I marked one of its options "disabled" --- took a bit of narrowing down, but that apparently was the problem for reasons that completely escape me!
1553023388
GiGs
Pro
Sheet Author
API Scripter
Great!
1553039855
vÍnce
Pro
Sheet Author
I often grab chunks of code and test for unclosed tags using&nbsp; <a href="https://www.aliciaramirez.com/closing-tags-checker/" rel="nofollow">https://www.aliciaramirez.com/closing-tags-checker/</a> &nbsp; It's a "bacon-saver". ;-P
1553040444

Edited 1553040464
GiGs
Pro
Sheet Author
API Scripter
Thats a nice find, Vince. i did try to run the above code through another html validator but it failed because it didnt recognise the fieldset tag. This one just checking for unclosed tags without needing to know the underlying code is pretty handy.