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

Help with "formula: undefined" non-terminating error in custom charactersheet

1699836517

Edited 1699836949
Evening all,   Please forgive me for being a total html novice but i've been making (what feels like) good progress with creating a custom sheet for an upcoming playtest but at some point in my travels, multiple non-terminating errors have started appearing in the console whenever a charactersheet loads/reloads ala below: "ERROR parsing formula: undefined" "TypeError: formula is undefined" I promise you that I have attempted to trace the errors via the debugger tool and some googlefu but my general lack of understanding and the absolute lack of clarity therein haven't made it very helpful to me... stranger still every piece of the sheet appears to be functioning correctly so it's unclear what if anything is failing to parse. I've no idea when they got introduced or i'd fiddle with my last edited section of code until they went away and I know for a fact that i've made large amounts of progress since they first started appearing so attempting to roll back the whole sheet is a no-go. Through a process of elimination (removing large blocks of code and testing the sheet piecemeal until the errors go away) i've identified that my sheet-workers & roll-templates are all OK and have discovered generally which section/s the errors occur in but I've no idea what I'm looking for to fix them. My instinct was an ill-defined type="ABC" but I'm struggling to see anything wrong. If anyone with more familiarity with html or the roll20 specific syntax has any insight i'd be glad to hear it. Alternatively as they are non-terminating errors and everything appears to be working I could ignore them, but this doesn't feel quite right. EDIT: I'd post the code itself but I don't expect anyone to comb through it on my behalf, it's also over 1200 lines all-told. I could post one of the "known troublesome" sections that is on the shorter side but I don't want to take the piss.
1699850510

Edited 1699898515
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, this is one of the many reasons to avoid using autocalcs. They are a pain in the butt to troubleshoot in addition to causing lag on sheets. The errors you are seeing are from the Roll20 client having an issue with one of your autocalc elements. The issue is probably going to be in the value property of your autocalc elements e.g.: <input disabled name="attr_an_attribute" type="text" value="some invalid macro expression"> Particular things to look for are things like missing a value on the input (doesn't give quite the same error you're getting, but it's close).
Interesting, thanks Scott.  I saw the line about autocalc formula but in my head said "I'm not using any autocalcs, this is gibberish". So somewhere on this sheet i've probably got an invalid macro expression sitting under an input, i was focussing on the "type" values so hadn't considered that the value field would be my problem. I shall have to do a pass over the sheet.
1699920169
GiGs
Pro
Sheet Author
API Scripter
Do you have any inputs that are disabled? They might be being interpreted as an autocalc, especially if they contain something that can be interpreted as a formula.
1699923618

Edited 1699923846
Through continued trial and error I discovered that 2 of my phantom errors were hiding in this section of code like a couple of goblins in shallow grass:     < div class = "f-row nowrap" >       < input name = "attr_inventoryitem_lefthand" type = "text" class = "repeating_inventoryitem_input" placeholder = "Left hand..." >       < div >         < label > Quick: < input name = "attr_inventorylefthandquick" type = "checkbox" value = "true" checked disabled ></ label >       </ div >     </ div >     < div class = "f-row nowrap" >       < input name = "attr_inventoryitem_righthand" type = "text" class = "repeating_inventoryitem_input" placeholder = "Right hand..." >       < div >         < label > Quick: < input name = "attr_inventoryrighthandquick" type = "checkbox" value = "true" checked disabled ></ label >       </ div >     </ div > And after some minor fiddling the issue here turned out to be that I had a pair of checkboxes with the value "disabled" set. Oddly though, it worked. The charactersheet presented a "checked" checkbox that was greyed out and uninteractable but didn't ever write a value to the attributes & abilities tab of the sheet. The other 2 of my 4 identical errors were a similar section on a different sheet tab. So with one mystery solved, does anyone have an explanation as to why I can't have a disabled checkbox (setting any checkbox to disabled appears to trigger this error for me) / how I could achieve a similar effect, preferrably without drawing an entire checkbox & checkmark using only CSS. EDIT: to say that GiG's pre-empted my discovery by an hour and I didn't notice... although i'd still be interested in an answer to my question about the interaction between checkboxes and disabled...
1699935028
GiGs
Pro
Sheet Author
API Scripter
I don't know why you'd want a disabled value of true, but you can replace disabled with readonly , or change the input to a span. I suspect that "true" is being detected as a formula result but there is no formula (in javascript, true can be treated as a number, so maybe that's what is going on).
1699939554
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Glad you found it!
GiGs said: I don't know why you'd want a disabled value of true, but you can replace disabled with readonly , or change the input to a span. I suspect that "true" is being detected as a formula result but there is no formula (in javascript, true can be treated as a number, so maybe that's what is going on). The value wasn't the desired outcome, the visual element was; game has inventory slots, some of which can be optionally marked as "quick access". From a readability point of view, it was to signal to the player that your hands are always treated as "quick". For consistencies sake if it eventually turned out that I wanted to do something programatic with the value of a slot being "quick" or not, I treated the static slot attributes the same as the repeating_ ones.