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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Extend Roll20 jQuery to allow toggling of the 'disabled' tag

1645516248
Peter B.
Pro
Sheet Author
Hello Roll20 I suggest that one of the next extensions to Roll20's jQuery implementation&nbsp; Roll20 JQuery &nbsp;should be the ability to toggle HTML elements to be&nbsp; disabled . My use case for this is to dynamically show/hide&nbsp; &lt;option&gt; -elements in a datalist. If a&nbsp; &lt;option&gt; -element in a datalist is&nbsp; disabled &nbsp;then it will not show up on the dropdown. This cannot be achieved with CSS therefore it is necessary to use the disabled &nbsp;tag. Here is an example of how the&nbsp; &lt;option&gt; -element is rendered in a select dropdown and in a datalist:&nbsp; <a href="https://jsfiddle.net/gu8knrhw/" rel="nofollow">https://jsfiddle.net/gu8knrhw/</a> Possibilities today I know that something similar to the example above is possible through the use of show/hide an input field, as described on the wiki:&nbsp; <a href="https://wiki.roll20.net/Character_Sheet_Enhancement#Datalist" rel="nofollow">https://wiki.roll20.net/Character_Sheet_Enhancement#Datalist</a> &lt; input type = "text" list = "classmage" name = "attr_class" class = "mage-skill" &gt; &lt; input type = "text" list = "classfighter" name = "attr_class" class = "fighter-skill" &gt; &lt; datalist id = "classmage" &gt; &lt; option value = "Spellcraft" &gt; Spellcraft &lt; /option &gt; &lt; option value = "Arithmancy" &gt; Arithmancy &lt; /option &gt; &lt; /datalist &gt; &lt; datalist id = "classfighter" &gt; &lt; option value = "Brawl" &gt; Brawl &lt; /option &gt; &lt; option value = "Weapon Mastery" &gt; Weapon Mastery &lt; /option &gt; &lt; /datalist &gt; This is all good if the values in each list are unique from each other, or if you only have two categories. If on the other hand the lists are subsets of each other, or extensions, then the combinatorial explosion will cause the amount of HTML needed to handle each case unreasonably high. Here is an example with a base set, and 3 extensions then the following combinations are possible: Base Base + E1 Base + E2 Base + E3 Base + E1 + E2 Base + E1 + E3 Base + E2 + E3 Base + E1 + E2 + E3 The amount of HTML needed can be seen in this jsfiddle:&nbsp; <a href="https://jsfiddle.net/ox3150wd/1/" rel="nofollow">https://jsfiddle.net/ox3150wd/1/</a> With disable toggle in Roll20 jQuery If we instead could use the Roll20 jQuery and to dynamically show / hide datalist options, then a single list would be all that was needed, and a sheetworker could handle what elements to show. For instance, if a player wanted the Base + E1 + E3 set then the html would look like this: &lt;datalist id="baseExtension1+2+3"&gt; &lt;!-- base --&gt; &lt;option&gt;base1&lt;/option&gt; &lt;option&gt;base2&lt;/option&gt; &lt;!-- extension1 --&gt; &lt;option&gt;extension1.1&lt;/option&gt; &lt;option&gt;extension1.2&lt;/option&gt; &lt;!-- extension2 --&gt; &lt;option disabled&gt;extension2.1&lt;/option&gt; &lt;option disabled&gt;extension2.2&lt;/option&gt; &lt;!-- extension2 --&gt; &lt;option&gt;extension3.1&lt;/option&gt; &lt;option&gt;extension3.2&lt;/option&gt; &lt;/datalist&gt; It looks neat and is easy to understand and maintain. It also removed the need for show / hiding different input fields which I see as a necessary evil at the moment. Possible problems The only problem I see, from the top of my head, is that disabled fields become&nbsp; Autocalc &nbsp;fields on a character sheet. I however believe that this is only the case when a fields is declared as disabled in the source code, and therefore gets added the&nbsp; data-formula &nbsp;field &lt;input type="text" name="attr_copper" value="[[1+2]]" disabled="" data-formula="[[1+2]]"/&gt; &lt;-------- This field If a field is just disabled&nbsp; without &nbsp;a data-formula field then it should act as a regular disabled field.
1671308436
Gold
Forum Champion
Yes please Roll20 empower Sheet Authors like Peter B to do this powerful toggle +1
+1 for this too.
+1
1678107699
John B
Pro
Sheet Author
help sheet developers
1682670850
Peter B.
Pro
Sheet Author
This can be closed as something has finally been made to allow this kind of feature for a character sheet&nbsp;<a href="https://app.roll20.net/forum/post/11413084/populate-list-options-sheetworker/?pageforid=11413084#post-11413084" rel="nofollow">https://app.roll20.net/forum/post/11413084/populate-list-options-sheetworker/?pageforid=11413084#post-11413084</a>