Advertisement Create a free account

Help retaining select (dropdown menu) attribute after sheet update

1547167978
Yui V.
Pro
Sheet Author
Hello, I am currently updating a character sheet and I have noticed that when I update the character sheet in my pre-existing campaign, select inputs on character sheets will forget their formerly selected option, displaying instead the top option. This is caused by the addition of a new option on top of the old ones that acts as a placeholder. The select attribute names did not change between versions, and everything is the same except for the new option and some additions in the original option values that shouldn't affect anything. So, updating the code to add a placeholder option resets the dropdown menu. What I am searching for is a way to prevent the dropdown menus from resetting on update so that players will find their updated sheets displaying the same options as before. If anyone has an idea hw to do this, or knows it is simply impossible, I would be glad to take their advise. Thank you. original code: <select name="attr_mlvariant"> <option value="@{strength}+@{endurance}">Aggressive</option> <option value="@{strength}+@{agility}">Precise</option> <option value="@{strength}+@{discipline}">Elegant</option> </select> updated code: <select name="attr_mlvariant"> <option value="++">Variant</option> <option value="@{strength}[Str]+@{endurance}[End]">Aggressive</option> <option value="@{strength}[Str]+@{agility}[Agi]">Precise</option> <option value="@{strength}[Str]+@{discipline}[Dis]">Elegant</option> </select>
1547225349
GiGs
Pro
Sheet Author
I'm not sure why this is happening? Are sure it is happening for characters that have already been designed which have entered values? You could enter a selected tag on on one the options to ensure one is always selected. If the players havent manually selected an option already, it may appear that it is changing the value - but its just because one hasn't yet been set yet. Creating a selected tag will make sure one is always selected even if players don't choose one manually.                                 <select name="attr_mlvariant"> <option value="++" selected>Variant</option> <option value="@{strength}[Str]+@{endurance}[End]">Aggressive</option> <option value="@{strength}[Str]+@{agility}[Agi]">Precise</option> <option value="@{strength}[Str]+@{discipline}[Dis]">Elegant</option> </select> If that doesnt work you could I guess try switching the order                                 <select name="attr_mlvariant"> <option value="@{strength}[Str]+@{endurance}[End]">Aggressive</option> <option value="@{strength}[Str]+@{agility}[Agi]">Precise</option> <option value="@{strength}[Str]+@{discipline}[Dis]">Elegant</option> <option value="++" selected>Variant</option> </select>
1547291175
Yui V.
Pro
Sheet Author
Hello, thank you for your answer. I checked again on your advise and have identified the problem: Not every dropdown from every character resets, and after further investigation, it appears that, since the former first option was a valid option, players that wanted it leaved the select at that, not touching it and therefore not creating a corresponding attribute in the Attributes & Abilities tab, as you suggested. Then, when the new option was added on top of the others, it would appear as selected on the sheets where the dropdowns weren't touched.  Now I know that the missing values were those of the former first choices though, and the addition of a placeholder option is in itself a fix to this problem, only not retroactive. Also, as I experimented, for dropdown menus placed within repeating fields, the values reset, as no attribute is created when selecting an option manually, and the tag 'selected' doesn't seem to work. But 'hidden' and 'disabled' do work. This doesn't cause much problems In my case, though. Thank you for helping me, have a nice day. I will close this topic tonight.
1547317733
GiGs
Pro
Sheet Author
You could try replacing selected with  selected="selected" and see if that works.