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

Button uncheck checkboxes in repeating sections

I have a repeating section with a checkbox in each row and I'm looking to create a button outside the repeating section that, when clicked, will set all the checkboxes in the repeating section to unchecked. Please can anyone help me out with the sheetworker for this? Here's the repeating section (the checkboxes to uncheck are called gearused ): <fieldset class="repeating_belongings"> <input type="text" name="attr_gear" style="width:125px;">   <input type="checkbox" name="attr_gun" value="1"><span></span>             <select name="attr_gearquality" style="width:175px;">   <option value="0">--quality--</option>   <option value="1">Crap: 1d4</option>   <option value="2">Normal: 1d6</option>   <option value="3">Normal & Excellent: 2d6</option>   <option value="4">Big: 1d8</option>   <option value="5">Big & Excellent: 2d8</option> <input class="sheet-si sheet-si0" type="checkbox" name="attr_gearquality" value="0"><!-- SI0 --> <input class="sheet-si sheet-si1" type="checkbox" name="attr_gearquality" value="1"><!-- SI1 --> <input class="sheet-si sheet-si2" type="checkbox" name="attr_gearquality" value="2"><!-- SI2 --> <input class="sheet-si sheet-si3" type="checkbox" name="attr_gearquality" value="3"><!-- SI3 --> <input class="sheet-si sheet-si4" type="checkbox" name="attr_gearquality" value="4"><!-- SI4 --> <input class="sheet-si sheet-si5" type="checkbox" name="attr_gearquality" value="5"><!-- SI5 -->   <div class="sheet-sishow-SI0"></div>   <div class="sheet-sishow-SI1"><button type="roll" value="/r (1 - @{gearused})d4s + ((1 - @{gearused}) * @{gun})d4s" name="gearRoll">Roll</button>  <input type="checkbox" name="attr_gearused" value="1"><span></span> </div>   <div class="sheet-sishow-SI2"><button type="roll" value="/r (1 - @{gearused})d6s + ((1 - @{gearused}) * @{gun})d4s" name="gearRoll">Roll</button>  <input type="checkbox" name="attr_gearused" value="1"><span></span> </div>   <div class="sheet-sishow-SI3"><button type="roll" value="/r ((1 - @{gearused}) * 2)d6s + ((1 - @{gearused}) * @{gun})d4s" name="gearRoll">Roll</button>  <input type="checkbox" name="attr_gearused" value="1"><span></span> </div>   <div class="sheet-sishow-SI4"><button type="roll" value="/r (1 - @{gearused})d8s + ((1 - @{gearused}) * @{gun})d4s" name="gearRoll">Roll</button>  <input type="checkbox" name="attr_gearused" value="1"><span></span> </div>   <div class="sheet-sishow-SI5"><button type="roll" value="/r ((1 - @{gearused}) * 2)d8s + ((1 - @{gearused}) * @{gun})d4s" name="gearRoll">Roll</button>  <input type="checkbox" name="attr_gearused" value="1"><span></span> </div> </fieldset>
1659541125
GiGs
Pro
Sheet Author
API Scripter
You'll need to use getSectionIDs for that. Once you grasp that function, it's pretty simple. on ( 'clicked:button' , () => {     getSectionIDs ( 'repeating_belongings' , id_array => {         const output = {};         id_array . forEach ( id => {             output [ `repeating_belongings_ ${ id } _gearused` ] = 0 ;         });         setAttrs ( output );     }); }); Change the name at the start: clicked:button to whatever your button is called. getSectionIDs is given a repeating section, and creates an array of row ids. Every row has its own unique id. The forEach loop function below builds the real, full name of each gearused attribute, and saves it with a value of 0. Then setattrs sets all the buttons to a value of 0 in one fell swoop.
Fantastic, thanks!