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

How do I make input data from 1 tab appear as read only in another?

Basically I want my character sheet to have a sort of overview tab that summarizes important information from other tabs like HP, MP, Equipment, etc. for quick viewing and display this data based on what is input into its respective tab. How would I go about doing this?
1551816700

Edited 1551817647
Jakob
Sheet Author
API Scripter
Create an input with the same name, but give it the readonly attribute. You can also use named spans instead if it looks better: <input type="text" name="attr_hp" readonly> <span name="attr_hp"></span> You can do the same thing for repeating sections too, just make sure to use the same name and use CSS to hide the add and modify buttons.
Being readonly already hides the modification capability but simply just using the same attribute name as the stat i want on display results in an empty field.
1551825193

Edited 1551825268
David
Sheet Author
The name only works with spans as in Jakob's 2nd example. 
Yeah span worked fine, too bad it doesn't work in preview though. Thanks!
1551848512
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, preview should only be used for layout. Even then it's not always accurate.
Yeah, I double-check the in-game sheet with the preview to see if anything is off and take notes of what is and correct it.
1551852308
Jakob
Sheet Author
API Scripter
Joe said: Yeah span worked fine, too bad it doesn't work in preview though. Thanks! Both spans and inputs work, neither works in preview, because the preview tab is useless :D.
I did check input in-game and it didn't work but span worked fine.
1551890919
GiGs
Pro
Sheet Author
API Scripter
I do this all the time, and have never used spans, I always use inputs. So there must be a syntax reason why your inputs didnt work. It doesn't really matter if you are happy with the spans. But if you want to find out why the inputs didnt work, posting some code from the sheet might give us a clue.
1551895302

Edited 1551895561
After trying again I found the following results: For my sheet current HP is connected to the Attributes & Abilities tab, and both of these work fine:  <input type="text" name="attr_HP" readonly>  <span name="attr_HP"></span> Replacing text with number also works. Max HP, however, is not called from the Attributes & Abilities tab but rather from a Character Sheet tab using the code <input type="number" name="attr_mhp1" style="width:100%" value="999" max="999" disabled> (the value is temporary for testing purposes lol) so when i have Jakob's input and span codes call on that attr span works but input does not. As you said though GiGs one result works and that is good enough but I hope this info helps for future references because I'm quite sure nothing is wrong with my max HP coding since span works with it and all. Also I did try changing text to number as well and same result, an empty field for max HP.
1551898998
Jakob
Sheet Author
API Scripter
Ah, that makes sense. If it's a disabled input, you'll have to make the input on the overview page disabled as well. (I recommend not using disabled inputs at all, however).
Far as I know I have to use disabled for a formula value, which is what max HP will rely on. That said I tried adding disabled to the code you suggested but no dice. Also span displays the formula and not the formula value. How do I fix that?
1551901364
Jakob
Sheet Author
API Scripter
So you can (Recommended) use sheet workers to set the value of max HP. This will solve the issue with spans displaying the formula, and it will make readonly inputs work. Duplicate the formula in every disabled input that uses it.
I'm more of a less hassles kind of guy so I tried option 2 and it worked. Thanks!