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

Pre-inserting repeating section rows

1598143898
Eric
Sheet Author
Hi all, What have you all been doing to pre-populate a repeating section with some blank rows on new character sheet opening? I would like to have several of my repeating sections showing at least 2 or 3 rows when opened on a new sheet; it just looks better then being empty areas. Should I just repeat the html a few times BEFORE the <fieldset> tag, in order words hard-coding the rows, or are you running sheet worker code in open event to do some generateRowID actions and setting values to cause rows to create? I couldn't really find any reference to people doing this so I'm guessing its not a popular strategy?
1598148111
GiGs
Pro
Sheet Author
API Scripter
You're right it's not a popular strategy. There's a couple of issues: It can create confusion for players, unless those two or three rows a filled with complete entries, and you have the tricky task of making them relevant to every player. If they are dont as a repeating section, plays can delete them. That can conflict with the way you initially create them, creating useless that rows players cant get rid of. If you really do want to do this (I recommend you don't), the best way is to just as you say have the html a few times before the fieldset tag. But if players create macros, that creates 2 or 3 rows that use different code to the repeating section. More confusion! Another way would be to use the sheet:opened  event. Whenever the sheet is opened, count the number of rows in the repeating section. If it's below 3 (for example), add your starting rows up to 3. But as I mentioned above, this creates complications if players ever delete them - they'll just keep coming back. There's really no good reason to add such rows. If the repeating section is relevant, it wont stay empty for long - players will add things to it. 
1598197419
Jakob
Sheet Author
API Scripter
It can look nicer, but do it right. I do it on a couple of sheets, 1 or two rows, just for visuals. Should I just repeat the html a few times BEFORE the <fieldset> tag, in order words hard-coding the rows, Don't do this. You'll thank me later. or are you running sheet worker code in open event to do some generateRowID actions and setting values to cause rows to create? That's fine, but only do it when setting up a blank sheet for the first time. Do not add extra rows or top them up to have at least X rows every time; just set the initial state to X rows, and if players delete them, that's their choice.
1598209258
Eric
Sheet Author
Thanks folks.  I set up a routine to do similar to Jakob's approach, seems to be working nicely.  Cheers.