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

Store row ID of repeating sections in hidden attribute

I would like to store the row ID in a hidden attribute such that I am able to  getSectionIDs("repeating_weaponsranged", function(idarray) { for(var i=0; i < idarray.length; i++) { //Do something with the IDs console.log(idarray[i]); setAttrs({ "repeating_weaponsranged_"+idarray[i]+"_weaponsranged_id":idarray[i] }); } }); Is it possible to store the ID in a hidden attribute like this?
1456609468
Lithl
Pro
Sheet Author
API Scripter
Sure, the id is just a string, but what are you trying to accomplish with that?
1456610674

Edited 1456613604
I want to generate a rollbutton command "!do @{weaponsranged_id} --add-ammunition 1" which tells my API script which rows attribute to modify. Doesn't javascript treat variables for keys in a dict as strings? The above code doesn't set the attribute for this html code: <fieldset class="repeating_weaponsranged"> <input type="text" name="attr_weaponsranged_id" value=""></input> For example: If I understood it correctly in Javascript the following does store the id in an attribute called attr_name and not in the attr_repeating_weaponsranged_X01200129fd87_weaponsranged_id var name = "repeating_weaponsranged_"+idarray[i]+"_weaponsranged_id"; setAttrs({ name:idarray[i] });
1456633653
Lithl
Pro
Sheet Author
API Scripter
If you want to construct the attribute name to set, you need to do it separately from the setAttrs call: var attrs = {}; attrs['repeating_weaponsranged_' + idarray[i] + '_weaponsranged_id'] = idarray[i]; setAttrs(attrs);
Ah thank you!