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 extracting text input

I need to get some input entries out of a repeating section so that another sheetworker can perform a roll with it. Here's what I've got: <input type="number" name="attr_capstat" /> <input type="text" name="attr_whichcap" /> <fieldset class="repeating_captains"> <input type="text" name="attr_capname" /> <input name="attr_fight" type="number" /> <button type="action" type="number" name="act_capfight" >Fight</button> </fieldset> <script type="text/worker"> on('clicked:repeating_captains:capfight', () => {     getAttrs(['repeating_captains_fight', 'repeating_captains_capname'], v=> {         setAttrs({            capstat:  (+v.repeating_captains_fight || 0),            whichcap:  (+v.repeating_captains_capname || 0)         })     }) }); </script> So the requirement is for when the capfight button in the repeating section is clicked then – – the capstat input outside the repeating section will update with the value of the fight input within the repeating section – the capname input outside the repeating section will update with the text entry of the capname input within the repeating section This works for capstat but whichcap just gets a 0, so I assume I just need a different syntax to capture text rather than a numerical value?
1647265532

Edited 1647278124
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You are converting capname to a number, which fails, so it sets it to 0. You just need: whichcap: v.repeating_captains_capname Edit: edited to remove erroneous capitalization.
Magic, cheers Scott!
1647278085
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Gah, note I didn't mean to capitalize whichcap, that was thanks to phone autocorrect.