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 in repeating section not finding the right attribute?

1626387056
Richard T.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
Having a weird thing where a button in a repeating section can't seem to find certain attributes in the button but I know it can find in other parts of the repeating section.  Here's my button: <button type="roll" name="btn_power-attack" value="&{template:roll} {{name=@{character_name}}} {{trait=@{attack_name}}} {{result=[[1d20cs>@{attack_crit} + @{attack_rank} + @{attack_misc}]]}} {{affliction_type=@{afflictions_type}}} {{affliction_check=@{afflictions_check}}} {{affliction1=@{afflictions_1}}} {{affliction2=@{afflictions_2}}} {{affliction3=@{afflictions_3}}}"><input type="number" name="attr_attack_rank" readonly placeholder="0"></button> The button displays in chat like so: So its missing a bunch of attributes and yet on the sheet, inside the same repeating-section it seems to find the attributes just fine.  <div class="display_afflictions">                 <span class="">Afflictions</span>                 <span class="redlabel" name="attr_afflictions_type"></span>                 <span class="redlabel __dc" name="attr_afflictions_check"></span>                 <div class="afflictions">                   <span class="affliction" name="attr_afflictions_1"></span>                   <span class="affliction" name="attr_afflictions_2"></span>                   <span class="affliction" name="attr_afflictions_3"></span>                 </div> </div> Am I just making a dumb mistake somewhere? 
1626388145

Edited 1626388212
GiGs
Pro
Sheet Author
API Scripter
Try setting a default value for each of them. IIRC this is a problem with attribute-backed-spans inside repeating sections. (If they have a matching input or select somewhere else, make sure the default value is the same for both.)
1626389434
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, GiGs probably has it. Attribute backed spans don't actually exist in a repeating section until they have a value, and they can't auto create a default value. Also, the value property in a span does nothing for them, you need to back them with a hidden version of the attribute that has value property for whatever default value you want.
1626390621
Richard T.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
The values in the spans are actually being put in place by a duplicate of the repeating section. Its how "Dazed" "Confused" and "Unconscious" are being displayed. That part, that lives elsewhere in the sheet, looks like this <div class="edit_afflictions">             <span>Afflictions</span>             <label>Resistance Type <input type="text" list="defense-types" name="attr_afflictions_type"></label>             <label>Resistance Check <input type="number" name="attr_afflictions_check"></label>             <label>First Degree <input type="text" name="attr_afflictions_1"></label>             <label>Second Degree <input type="text" name="attr_afflictions_2"></label>             <label>Third Degree <input type="text" name="attr_afflictions_3"></label> </div> Unless maybe the button wants to be in the same repeating field as the input? As far as I would have guessed, all the attributes of the repeating-sections live in the duplicates. 
1626391058

Edited 1626391180
Richard T.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
Hidden inputs did seem to solve it. Its weird that the spans can pull it from the ether but the roller can't.