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

Making a repeating field with a fixed amount of entries

1556429168
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Is it possible to create a repeating field with a fixed amount of entries without an add/remove button. Let's say 10 or 20.
1556429864
GiGs
Pro
Sheet Author
API Scripter
If you want to make a section with a fixed number of entries, why do you want to make it a repeating field? Genuine question - I'm confused. Seems like it would be easier to just create normal fields and use CSS to control visibility if needed. Repeating fields introduce complications, and if you can do without them, it's a lot easier on the players (easily understandable attribute names, for example).
1556431889
Jakob
Sheet Author
API Scripter
GiGs said: If you want to make a section with a fixed number of entries, why do you want to make it a repeating field? Genuine question - I'm confused. Seems like it would be easier to just create normal fields and use CSS to control visibility if needed. Repeating fields introduce complications, and if you can do without them, it's a lot easier on the players (easily understandable attribute names, for example). +1.
1556434347
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
It's a good question the main reason is simplicity to write the workersheet functions and less possibility to make mistakes. Right now I'm writing stuff like "sorry the 20 extra skill spaces check which one changed, parce the word of the event that initialize the function, get the corresponding I'd, modify the value with the ID  Also I would like to have at least 5-10 repeating fields, as a minimum, already created but empty :)
1556434757
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is possible by using sheetworkers to create the entries and css to hide the add/delete buttons. I could see it being a useful method for handling things that have essentially the same code repeated multiple times instead of handwriting each section and then copy/pasting with small changes (e.g. acrobatics instead of athletics) or using regex to programmatically generate the section of essentially repeating items. Doing this would (as an off the cuff estimate) remove a couple hundred lines of html from my sheets.
1556435705
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
That would be great Scott. I know how to remove the button but not sure how to do the rest :( So far I created a fixed amount of fields manually and it's... Ok for me. But if someone has to refactor/change the sheet..  it would be a pain in the ass.
1556438095
GiGs
Pro
Sheet Author
API Scripter
Honestly, i still think you're better off without using a repeating section. You can duplicate a section 10-20 times easily enough with copy/paste, and the only things you'd need to change within those section are attribute names which could be done again with fairly quick copy/paste. I dont think the extra lines in the html will make any difference efficiency-wise (probably better, honestly). You can write functions to handle all the attributes without duplication (some techniques for that here&nbsp; <a href="https://wiki.roll20.net/UniversalSheetWorkers" rel="nofollow">https://wiki.roll20.net/UniversalSheetWorkers</a> ), and you (and more importantly, the players when creating their own macros) don't have to deal with randomly generated UUID's in attribute names. That said, it's your sheet so I wont press the issue :)
1556439191
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
you are probably right. My problem is many times I have stuff like on change skill1 change score1 on change skill2 change skill2 etc... My trick was parcing and get the number
1556439979
GiGs
Pro
Sheet Author
API Scripter
That's definitely a solvable problem as that linked page should show. If you need help creating a sheet worker that does the same job for multiple stats, I'm always happy to help (and that link I gave may help too).
1556488042
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Oh no I solved it it's just... Not elegantly solved 😅.