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

[QUESTION] auto-calc span?

1526881436

Edited 1526881494
Darren
Pro
Sheet Author
API Scripter
I'm just beginning to learn sheetworkers (and this is only indirectly a sheetworker question). I believe... A field will only auto-calc if it is disabled="true" "It is possible to include a span tag that has the same attribute name as an input tag, and the span tag will be updated whenever the input is modified." When I try this together, the span only gets the text of the formula, not the result of the formula. <span name="attr_STR"></span> <input type="text" name="attr_STR" value="(@{STR_base}+@{STR_pow})" disabled="true" /> The input field shows the correct value.  So if STR_base = 15 and STR_pow = 3, then the input field displays 18.  That works. However, the span displays "(@{STR_base}+@{STR_pow})", which is of course not what I wanted.  I wanted it to display the calculated value. I'm I doing something wrong, or do I have to use a sheetworker for this?
1526884771
Jakob
Sheet Author
API Scripter
Either use a sheet worker, or take a disabled input and remove all the input-like styling.
1526891570
GiGs
Pro
Sheet Author
API Scripter
Jakob said: Either use a sheet worker, or take a disabled input and remove all the input-like styling . Can you expand on the specifics of this? 
1526894314

Edited 1526894609
Jakob
Sheet Author
API Scripter
G G said: Jakob said: Either use a sheet worker, or take a disabled input and remove all the input-like styling . Can you expand on the specifics of this?  Disclaimer: you shouldn't do this. Just use sheet workers instead. ... ... ... Okay, I was thinking of something like <input type="text" name="attr_something" class="sheet-i-really-want-to-avoid-sheetworkers" value="@{formula}" disabled> .sheet-i-really-want-to-avoid-sheetworkers { -webkit-appearance: none; -moz-appearance: none; background: transparent; border: none; color: inherit; padding: 0; font: inherit; width: 2em ; line-height: inherit; border-radius: 0; margin: 0; box-shadow: none; outline: none; vertical-align: baseline; cursor: text; } It will not really look like a span, since its width will never be set automatically to be equal to the content width, but this should approximate it, as long as you can control the width... That having been said, don't use this, just use sheet workers.