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

Sheetworker for auto-fill from drop-down

I've read a few solved threads that seem to be about the same thing I'm after, but can't manage to replicate it so hopefully where I'm going wrong will be obvious to someone. I'm looking to have a repeating section in which there is a drop-down field and a bunch of others. Then a sheetworker will fill in the other fields depending upon what is selected in the dropdown. Here's the drop-down: <select name="attr_gearname"> <option value="gun">gun</option> <option value="knife">knife</option> <option value="car">car</option> </select> Here are the fields to populate: <input type="text" class="sheet-open" style="width:200px;" name="attr_effe" /> <input type="text" class="sheet-open" style="width:200px;" name="attr_qual" /> <input type="text" class="sheet-open" style="width:200px;" name="attr_upgr" /> Here's the sheetworker:     on("change:gearname", function () {     getAttrs(['gearname'], function(values) {         const gears = {            gun: {Effect: "GE", Qualities: "GQ", Upgrades: "GU"},            knife: {Effect: "KE", Qualities: "KQ", Upgrades: "KU"},            car: {Effect: "CE", Qualities: "CQ", Upgrades: "CU"},         };         let gearname = values.gearname;                 setAttrs({             "effe": gears[gearname].Effect,             "qual": gears[gearname].Qualities,             "upgr": gears[gearname].Upgrades         });     }); }); Can anyone spot the problem?
1601722516
Finderski
Plus
Sheet Author
Compendium Curator
You need to include the repeating section with the call. For example, if the repeating section was repeating_gear, then you'd have: on("change:repeating_gear:gearname", function () {     getAttrs(['repeating_gear_gearname'], function(values) {         const gears = {            gun: {Effect: "GE", Qualities: "GQ", Upgrades: "GU"},            knife: {Effect: "KE", Qualities: "KQ", Upgrades: "KU"},            car: {Effect: "CE", Qualities: "CQ", Upgrades: "CU"},         };         let gearname = values.repeating_gear_gearname;                 setAttrs({             "repeating_gear_effe": gears[gearname].Effect,             "repeating_gear_qual": gears[gearname].Qualities,             "repeating_gear_upgr": gears[gearname].Upgrades         });     }); }); I'm not the best with sheet workers, so, there may be other issues, because I haven't tested the above, but I know the repeating stuff is definitely a problem...
Yep, that was it! Cheers fella.