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

Attempting to add the ability to input text into drop down menu

1504365490
Pat S.
Forum Champion
Sheet Author
I'm trying to modify a drop down selection to allow players to input custom dice. I was able to get it to work with the ?{query roll} but I want it to retain the dice inputted also due to it being a weapon field. This is what I'm attempting right now. <div title="Weapon damage"> <select name="attr_meleedmg"> <option value="1d3">1d3</option> <option value="1d4">1d4</option> <option value="1d6">1d6</option> <option value="1d8">1d8</option> <option value="1d10">1d10</option> <option value="1d12">1d12</option> <option value="2d6">2d6</option> <option value=<input type="text" name="attr_meleedmg">custom dice</option> </select> </div> Suggestions or ideas?
1504366685

Edited 1504366903
vÍnce
Pro
Sheet Author
Not sure if you can nest an input within the  option selector like that...  "I want it to retain the dice inputted..." is the kicker.  ;-( You might have to include an additional input field for the custom roll.   <div title="Weapon damage">     <select name="attr_meleedmg">         <option value="1d3">1d3</option>         <option value="1d4">1d4</option>         <option value="1d6">1d6</option>         <option value="1d8">1d8</option>         <option value="1d10">1d10</option>         <option value="1d12">1d12</option>         <option value="2d6">2d6</option>         <option value="@{custom_meleedmg}">custom dice</option>     </select>     <br>     Custom <input name="attr_custom_meleedmg" type="text" value="" placeholder="custom roll" > </div>
1504366911
Pat S.
Forum Champion
Sheet Author
I tried various way and I came to the same assumption that I couldn't nest the input so I just removed the whole drop menu to go with just a blank text field. I'm working on keeping the sheet simple without to many breakable bits. Thanks for the thoughts.
1504366982
vÍnce
Pro
Sheet Author
As status quo, there is probably some cool sheetworker method to make this happen...
1504367061
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
On my phone,so wont have actual example code,but how about two attributes, one is the select, but instead of that input option as your final option, it's just "custom". Then you have a second attribute that is your text input. Have the text input as position: absolute and opacity:0 by default. Then use a sheetworker to set a check box to checked if the select=custom and have the text box switch to opacity: 100. similar to how Steve is doing the modified attribute colors for the  new version of the ogl sheet.
1504367079
Pat S.
Forum Champion
Sheet Author
I'm slowly dipping into the world of sheetworkers but for this, the KISS principle works best.