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

Custom character sheet: Disabled input without auto-calc?

May 15 (2 months ago)
PM
Pro

As the title states, I'm currently making a custom character sheet and relying on a sheetworker. I have not added any auto-calc fields, but would like several inputs to be disabled to users, but the sheet worker should be able to edit them. Unfortunately, if I make a field disabled, the character sheet API expects there to be an auto calc set up and throws an error when it cannot find it - and my sheetworker never gets to edit that value. Removing disabled from the input fixes this, but I really want the inputs to be disabled/readonly to the user.


So I was wondering if there is some way to mark an input disabled, but not have roll 20 consider it auto-calc?

May 15 (2 months ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

give it the readonly tag:

<input type="text" name="attr_attribute_name" readonly>
May 15 (2 months ago)
PM
Pro

Hey, I think that worked! Thanks!!

May 15 (2 months ago)
PM
Pro

I had assumed readonly would be treated the same as disabled based on the last line in the auto-calc section of the documentation.

> You can include an auto-calc formula in the default value for the field, and specify either disabled="true" or readonly attribute on the field. If you do so, the sheet will display the result of the formula instead of the formula itself.

But it does seem that auto-calcs are indeed not initiated for readonly fields. The fact that the user can still focus on them is a bit of a downside, but since they can't edit this serves my use case well.

Thanks a lot again!


May 15 (2 months ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Huh, that line is definitely incorrect. Not sure when that got changed on the wiki, but I could swear it used to discuss the difference between disabled and read-only.