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

[HELP] How to use if / endif to change the options of a list

Hello, I'm sure the next, the plug has a field called profession and a field called specialization, I would like that when the player selecionasse a profession the list of options in the field expertise change according to the chosen profession, someone would have an example how do I proceed? &lt;div&gt; &lt;span&gt;&lt;img src="<a href="http://i1109.photobucket.com/albums/h426/trodurizen/Logo_zpsa8tooaa2.jpg&quot;&gt;&lt;/span" rel="nofollow">http://i1109.photobucket.com/albums/h426/trodurizen/Logo_zpsa8tooaa2.jpg"&gt;&lt;/span</a>&gt; &lt;span&gt;&lt;label for="name"&gt;Nome:&lt;/label&gt;&lt;/span&gt; &lt;input type="text" name="attr_nome"/&gt; &lt;span&gt;&lt;label for="raca"&gt;Raça:&lt;/label&gt;&lt;/span&gt; &lt;select value="0" name="attr_raca" id"select-raca" &gt; &lt;option value="" selected&gt; &lt;/option&gt; &lt;option value="anao"&gt;Anão&lt;/option&gt; &lt;option value="e-dourado"&gt;Elfo Dourado&lt;/option&gt; &lt;option value="e-florestal"&gt;Elfo Florestal&lt;/option&gt; &lt;option value="humano"&gt;Humano&lt;/option&gt; &lt;option value="m-elfo"&gt;Meio-elfo&lt;/option&gt; &lt;option value="pequenino"&gt;Pequenino&lt;/option&gt; &lt;/select&gt; &lt;span&gt;&lt;label for="profissao"&gt;Profissão:&lt;/label&gt;&lt;/span&gt; &lt;select name="attr_profissao" id="select-profissao"&gt; &lt;option value="" selected&gt; &lt;/option&gt; &lt;option value="bardo"&gt;Bardo&lt;/option&gt; &lt;option value="guerreiro"&gt;Guerreiro&lt;/option&gt; &lt;option value="ladino"&gt;Ladino&lt;/option&gt; &lt;option value="mago"&gt;Mago&lt;/option&gt; &lt;option value="rastreador"&gt;Rastreador&lt;/option&gt; &lt;option value="sacerdote"&gt;Sacerdote&lt;/option&gt; &lt;/select&gt; &lt;span&gt;&lt;label for="especializacao"&gt;Especialização:&lt;/label&gt;&lt;/span&gt; &lt;select name="attr_especializacao" id="select-especializacao"&gt; &lt;option value="" selected&gt; &lt;/option&gt; &lt;option value="arautos"&gt;Arautos&lt;/option&gt; &lt;option value="artistas"&gt;Artistas&lt;/option&gt; &lt;option value="eruditos"&gt;Eruditos&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; .sheet-principal { background-color: white; width: 231px; height: 88px; } .sheet-label-name{ font-family:Palatino Linotype; font-size: 9; position:absolute; top:80px; left:280px; } .sheet-input-name{ width: 250px; font-family:Palatino Linotype; font-size: 12; position:absolute; top:70px; left:330px; border: 1px solid; border-top:none; border-bottom-left-radius: 0.5em; border-bottom-right-radius:0.5em; border-left: 1px; border-right: 1px; background-color: none; } .sheet-label-raca{ font-family:Palatino Linotype; font-size: 9; position:absolute; top:110px; left:280px; } .sheet-lista-raca{ width: 250px; font-family:Palatino Linotype; font-size: 12; position:absolute; top:100px; left:330px; border: 1px solid; border-top:none; border-bottom-left-radius: 0.5em; border-bottom-right-radius:0.5em; border-left: 1px; border-right: 1px; background-color: none; } .sheet-label-profissao{ font-family:Palatino Linotype; font-size: 9; position:absolute; top:140px; left:280px; } .sheet-lista-profissao{ width: 230px; font-family:Palatino Linotype; font-size: 12; position:absolute; top:130px; left:350px; border: 1px solid; border-top:none; border-bottom-left-radius: 0.5em; border-bottom-right-radius:0.5em; border-left: 1px; border-right: 1px; background-color: none; } .sheet-label-especializacao{ font-family:Palatino Linotype; font-size: 9; position:absolute; top:170px; left:280px; } .sheet-lista-especializacao{ width: 190px; font-family:Palatino Linotype; font-size: 12; position:absolute; top:160px; left:390px; border: 1px solid; border-top:none; border-bottom-left-radius: 0.5em; border-bottom-right-radius:0.5em; border-left: 1px; border-right: 1px; background-color: none; }
1476510249

Edited 1476510276
GMMJ
Pro
Hi, I managed to do something like that with style sheet and worker. You will neet the worker to catch the change event, some hidden checkbox to switch the visible status of your list and some css to hide / show them. In this exemple, I show/hide some text field if someone select the last choice in the list. HTML &lt;!-- the list --&gt; &lt;div data-i18n="txt_CharRace" style="width:70px;"&gt;Race :&lt;/div&gt; &lt;div style="width:165px;"&gt; &lt;select name="attr_CharRace"&gt; &lt;option data-i18n="txt_CharRaceAmazone" value="Amazone"&gt;Amazone&lt;/option&gt; &lt;option data-i18n="txt_CharRaceBarbarian" value="Barbarian"&gt;Barbare&lt;/option&gt; ... &lt;option data-i18n="txt_CharRacehalfling" value="halfling"&gt;Semi-Homme&lt;/option&gt; &lt;option data-i18n="txt_CharRaceOgre" value="Ogre"&gt;Ogre&lt;/option&gt; &lt;option data-i18n="txt_CharRaceOrc" value="Orc"&gt;Orque&lt;/option&gt; &lt;option data-i18n="txt_CharRaceOther" value="Other"&gt;- Autre -&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div style="width:165px;"&gt; &lt;!-- the hidden checkbox --&gt; &lt;input type="checkbox" name="attr_showCharRaceOther"&gt; &lt;!-- the field to show / hide --&gt; &lt;input type="text" name="attr_CharRaceOther"/&gt; &lt;span data-i18n="txt_TTipCharRaceOther"&gt;Autre râce&lt;/span&gt; &lt;/div&gt; Worker // Other race display field on("change:CharRace", function() { getAttrs(["CharRace"], function(Values) { if (Values["CharRace"]=="Other"){ setAttrs({"showCharRaceOther": "on"}); } else { setAttrs({"showCharRaceOther": "off"}); } }); }); CSS /* Hide / Show RaceOther text Field - from check box preceding */ .sheet-CharRaceOther { display:none; } .sheet-useCharRaceOther:checked + .sheet-CharRaceOther { display: inline; } The check bow must be preceeding and be on the same level of the block to display / hide in you case, you can use one list to select the profession (with the profession field) and N other hiden list to select expertise if you need to reuse the expertise somewhere else, you will need to had a hidden field updated when a selection is done in an expertise list. (or try to give the same name to you expertise lists and just play with the class name to show / hide the list you need but i dont tested that)
Hello guys and girls, thank you for your help, I do not know anything about HTML and CSS and learned a lot here at roll20 since I started trying to create my first record, but I reached a point that created a lot of topics for my doubts and more members are striving I do not understand how to solve them. I decided to start from scratch in another topic and take a course at a time so that I can learn rather than just have the answer for you, if you still want to help me created this new topic in which I am organizing my ideas before starting to write the code, I hope to count on your help. New topic: <a href="https://app.roll20.net/forum/post/4144563/help-cus" rel="nofollow">https://app.roll20.net/forum/post/4144563/help-cus</a>... Hugs and thanks!