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

Issue regarding attributes and input fields when creating a custom sheet

I recently started building a custom sheet and I got a few problems with my attributes and the inputs fields that define them: - The only thing working  is that upon modifying the value of an <input> the related attribute is updated. - Upon modifying the value of the attribute by any other mean than the above the value of the related <input> is not updated. - Auto-calculating fields do not work. - Lastly, the major problem , the values of every <input> (including those tied to attributes) are reseted upon closing the character sheet. An example of one of my <input>: <input class="stat-div-input" type="text" name="attr_nat-str"/> No matter what example I check, wiki included, I cannot pin point if I made a mistake somewhere or if I forgot to do something for my sheet to be functionning decently.
1540307902
Jakob
Sheet Author
API Scripter
This is weird. Can you post a link to the complete sheet code? I can't see anything that's wrong from this line only.
1540309151

Edited 1540310130
Here is a link to the full code (css included):&nbsp; <a href="https://github.com/Eclairius/customsheet" rel="nofollow">https://github.com/Eclairius/customsheet</a> It's a bit messy and I thinkered with some places to try to figure out what was wrong but overall the problem should be noticeable. Edit: I reverted the thinkered parts to avoid confusion, but I'm keeping the warning in case I forgot somes. Edit 2: The &lt;input&gt;s related to the attributes called in the autocalcs can be found near&nbsp;the bottom of the code.
1540311172
GiGs
Pro
Sheet Author
API Scripter
I can see two definite problems. First, your fieldsets aren't named correctly. They need to be named something like &lt;fieldset class="repeating_something"&gt; the repeating_ is essential, and you should just have a single class name, no spaces. Second, your autocalc fields are drawing on items inside a fieldset which will fail. You see, items in a fieldset have a multi-part attribute name. The name here: &lt; p &gt;Vie max&lt; input type = " text " name = " attr_o-hp " /&gt;&lt;/ p &gt; is only part of the attribute name. When an attribute is created it will actually have a name like repeating_fieldset_complexID_o-hp. So an autocalc field like this &lt; input class = " cinput " type = " text " name = " attr_c-hp " value = " [[@{o-hp}]] " disabled = " true " /&gt; looks for an attribute named o-hp, but cant find one since it doesnt exist.&nbsp; But even if it did work, a fieldset also contains multiple copies of each named attribute, (with the previous prefixes in the example above) so the autocalc has no way to know which o-hp to pick Hope this helps!
I didn't knew attributes in a fieldset that is not marked repeating_ are still multipart. I switched every fieldset not used as a repeating section to div and everything works fine! Thanks for the help!
1540316093
GiGs
Pro
Sheet Author
API Scripter
Great :)
1540319989
Jakob
Sheet Author
API Scripter
Ah, an errant fieldset, that's what I had suspected. Glad the problem could be solved.