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

Select and CSE

1646588041

Edited 1646590891
Kraynic
Pro
Sheet Author
I may have missed something on the wiki.  I can't find any mention that selects don't work in CSE.  One of my sheets contains the following: <select class="aim-type parchment" name="attr_aiming" /> <option value="-6" title="Spray Primary Target, -6">Spray</option> <option value="0" title="Wild, no bonus" selected="selected">Wild</option> <option value="1" title="Burst, +1">Burst</option> <option value="3" title="Aimed, +3">Aimed</option> <option value="4" title="Aimed Revolver, +4">Aimed R</option> <option value="5" title="Aimed with Sniper, +5">Aimed S</option> </select> I can drop that by itself (no css) in a game with the sheet set use a "legacy" custom sheet and it will create a working drop down list.  If I disable legacy mode, I get this instead: Is there some trick to get this to work, or do I need to switch to a different format altogether? Solution found: Don't terminate the first line that way.  The first line should be: <select class="aim-type parchment" name="attr_aiming" >
1646589022
GiGs
Pro
Sheet Author
API Scripter
That's interesting. I have used selects in CSE without issue, so I don't know what's going on there. I'd look to see if there's anything the structure of the page before that. Does that select work if you copy it to the very start of your html, before everything else. What is the title tag doing in there?  I've never seen that in a select before. Could it be something to do with the comma in the option values? (I'm just clutching at straws).
1646590091

Edited 1646590390
Kraynic
Pro
Sheet Author
That screenshot is with no other code in the custom sheet editor, so there is nothing before it.  Only what is posted in the code block. Removing the commas makes no change. Simply opening the sheet gives me the view in the screenshot above. If I enable legacy mode, it looks like this on sheet open, and functions normally when opened. Edit: I tried removing the title hover text entirely, but that made no difference.  I also tried removing all the spaces in front of it that were held over from copying it indented from the sheet code.  So the following also does not work in CSE: <select class="aim-type parchment" name="attr_aiming" /> <option value="-6">Spray</option> <option value="0" selected="selected">Wild</option> <option value="1">Burst</option> <option value="3">Aimed</option> <option value="4">Aimed R</option> <option value="5">Aimed S</option> </select>
1646590756

Edited 1646590810
Kraynic
Pro
Sheet Author
Well, I found the issue...  The first line can't terminate in />.  It has to be the simple >.  So the first line from the first post should be: <select class="aim-type parchment" name="attr_aiming" > instead of <select class="aim-type parchment" name="attr_aiming" /> I have no idea why I terminated it that way.  I can't find any examples that have that line ending.  So I guess it was a personal error that was ok until now!
1646591537
GiGs
Pro
Sheet Author
API Scripter
aha I missed that too.  You can only use that ending with elements that are self-closing (like inputs, where there is no </input> closure). I'm surprised it works with legacy mode.
1646592187
Kraynic
Pro
Sheet Author
Well, it isn't the first time I have had code in a sheet that "shouldn't work".  lol
1646592912
GiGs
Pro
Sheet Author
API Scripter
Hehe, true.
1646598280

Edited 1646598345
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah think CSE is slightly more strict with how css & html is allowed to be written, so bad practice code that in the past would work on LCS, no longer is permissible in CSE. Follow general styleguides   and the roll20-specific stuff like BCS/Roll_Templates#Restrictions and most of these kind of things can be avoided. Using an IDE that warns about stuff like these is even better. VS Code showed the bad "\" in red for me: