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

setting value in a select dropdown

I have a repeating skills section in which I  want the players to be able to lock their skills with a button. I did this by swapping the row for one in which everything is disabled, and it works great.  The only problem is that I have a dropdown to select which ability modifies the skill. In the disabled one, I cannot get it to show the same value that was selected. I tried replacing it with a span with the same name, but that shows the value of the selection instead of the name.  So if the option <option value=@{dexterity}>DEX</option> is selected, it will show "@{dexterity}" when I want it to show "DEX", just as it does in the enabled dropdown. Does anyone know of a way to do this?
1610507963
GiGs
Pro
Sheet Author
API Scripter
We'd have to see the code for the normal and disabled section to see why it's happening and how to fix it.
1610514979

Edited 1610515181
This is the html: <div> <input type="checkbox" class="sheet-block-switch" name="attr_block_switch" value="1"> <div class="sheet-block-a" style="margin-top:-28px;margin-left:16px;"> <button type="action" class="lockbutton"name="act_lock">)</button> <button type="roll" class="skill-button" value="&{template:API-button}{{button=[@{skill-name}](!
/as @{character_name} @{skill-roll-templ})}}"></button> <input type="text" name="attr_skill-name" class="skill-name" style="margin-left:4px;" value="New Skill"/> <select name="attr_ability" class="ability-select"> <option value=@{strengthe}>STR</option> <option value=@{dexterity}>DEX</option> <option value=@{intelligence}>INT</option> <option value=@{perception}>PER</option> <option value=@{will}>WIL</option> </select> <input type="hidden" name="attr_skill-level" value="1" /> <input type="hidden" name="attr_skill" class="dot" value="1" /> <button type="action" name="act_skill-1" class="dot dot-0"> - </button> <button type="action" name="act_skill-2" class="dot gt-1"> <span class="checked"></span> </button> <button type="action" name="act_skill-3" class="dot gt-1 gt-2"> <span class="checked"></span> </button> <button type="action" name="act_skill-4" class="dot gt-1 gt-2 gt-3"> <span class="checked"></span> </button> <button type="action" name="act_skill-5" class="dot gt-1 gt-2 gt-3 gt-4"> <span class="checked"></span> </button> <button type="action" name="act_skill-6" class="dot gt-1 gt-2 gt-3 gt-4 gt-5"> <span class="checked"></span> </button> <button type="action" name="act_skill-7" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6"> <span class="checked"></span> </button> <button type="action" name="act_skill-8" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7"> <span class="checked"></span> </button> <button type="action" name="act_skill-9" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7 gt-8"> <span class="checked"></span> </button> <button type="action" name="act_skill-10" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7 gt-8 gt-9"> <span class="checked"></span> </button> <select name="attr_effect-die" class="ability-select"> <option value="0">d2</option> <option value="1">d4</option> <option value="2">d6</option> <option value="3">d8</option> <option value="4">d10</option> <option value="5">d12</option> <option value=@{strengthe}>STR</option> <option value=@{dexterity}>DEX</option> <option value=@{intelligence}>INT</option> <option value=@{perception}>PER</option> <option value=@{will}>WIL</option> </select> <span style="padding-top:12px;width:2em;">keep</span> <select name="attr_keep" class="ability-select"> <option value="k1">1</option> <option value="k2">2</option> <option value="k3">3</option> </select> </div> <div class="sheet-block-b" style="margin-top:-28px;margin-left:16px;"> <button type="action" class="lockbutton"name="act_lock">(</button> <button type="roll" class="skill-button" value="&{template:API-button}{{button=[@{skill-name}](!
/as @{character_name} @{skill-roll-templ})}}"></button> <span name="attr_skill-name"class="skill-name" style="margin-top:14px;width:96px;"></span> <select disabled name="attr_ability" class="ability-select" value=@{ability}> <option value=@{strengthe}>STR</option> <option value=@{dexterity}>DEX</option> <option value=@{intelligence}>INT</option> <option value=@{perception}>PER</option> <option value=@{will}>WIL</option> </select> <input type="hidden" name="attr_skill-d" class="dot" value="1" /> <button disabled type="action" name="act_skill-d-1" class="dot dot-0"> - </button> <button disabled type="action" name="act_skill-d-2" class="dot gt-1"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-3" class="dot gt-1 gt-2"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-4" class="dot gt-1 gt-2 gt-3"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-5" class="dot gt-1 gt-2 gt-3 gt-4"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-6" class="dot gt-1 gt-2 gt-3 gt-4 gt-5"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-7" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-8" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-9" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7 gt-8"> <span class="checked"></span> </button> <button disabled type="action" name="act_skill-d-10" class="dot gt-1 gt-2 gt-3 gt-4 gt-5 gt-6 gt-7 gt-8 gt-9"> <span class="checked"></span> </button> <select disabled name="attr_effect-die" class="ability-select"> <option value="0">d2</option> <option value="1">d4</option> <option value="2">d6</option> <option value="3">d8</option> <option value="4">d10</option> <option value="5">d12</option> <option value=@{strengthe}>STR</option> <option value=@{dexterity}>DEX</option> <option value=@{intelligence}>INT</option> <option value=@{perception}>PER</option> <option value=@{will}>WIL</option> </select> <span style="padding-top:12px;width:2em;">keep</span> <select disabled name="attr_keep" class="ability-select"> <option value="k1">1</option> <option value="k2">2</option> <option value="k3">3</option> </select> </div> </div> </div> </div> </fieldset>
I was trying to create a checkbox to lock the skill, so it couldn;t be changed by an errant click, and that works, but the information doesn;t display correctly, and it sends the incorrect data to my macro as a result.