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 with disable toggle

1642168726

Edited 1643721171
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 disabled . My use case for this is to dynamically show/hide &lt;option&gt; -elements in a datalist. If a &lt;option&gt; -element in a datalist is disabled &nbsp;then it will not show up on the dropdown. Here are an example on jsfiddle:&nbsp; <a href="https://jsfiddle.net/5ba8L6ns/" rel="nofollow">https://jsfiddle.net/5ba8L6ns/</a> For those who wonder here is an example of how the &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 Autocalc 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 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 without &nbsp;a data-formula field then it should act as a regular disabled field.
Thanks for the suggestion! After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness. Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here .