1
I have a forum with a field select
which has many options to select, I would like to divide these options by forum area in two select
.
All areas and sub-areas are in a single select
.
Example:
<div class="blockrow">
<label for="destforumid">Fórum de Destino:</label>
<select id="destforumid" name="destforumid" class="primary" tabindex="1">
<option value="5" class="d0">Feedback (Categoria)</option>
<option value="23" class="d0">Fórum de Estudos (Categoria)</option>
<option value="7" class="d1"> Anúncios e Enquetes</option>
<option value="19" class="d1"> Fale Conosco (Link)</option>
<option value="10" class="d0">Designs (Categoria)</option>
<option value="14" class="d2"> Pedidos</option>
<option value="29" class="d3"> Atendidos (Sem Postagem)</option>
</select>
From what I could see, d0
is the category, not the forum. d1
is a forum of d0
above and when there is a d2
below the d2
, is a sub-forum, that is, a forum within the forum d1
who is in the category d0
.
If there are two d2
, means that there are 2 forums in this category, very simple to understand. in the case of a d3
after a d2
, means that the d2
which is a forum, will have another forum within, which is the d3
. And so on, there may be several d1
, d2
, d3
, d4
...
Categories are divided with each new d0
.
I would like to get all these values with js, where in the first, current select
I would select only the categories I want, and in the second I would select the subforum of that selected category I want.
All the select
has a given, the value
, are they who identify the selected location.
The second select would have to have the data id="destforumid" name="destforumid" class="primary" tabindex="1"
'cause without it it might not work.
How could I get javascript to automatically capture this data from select
and organised in the manner described in 2 select
so that there wouldn’t be a huge list?
Note: I left select with few options, sufficient for example and understanding, but in the forum are hundreds if areas, so the division would facilitate and much.
– Florida
The first would not be the same, I forgot to put in question this detail, the first would serve only for the categories, the second is what I would actually select. In the case of select
Feedback (Categoria)
, it has no sub-forum, would have to repeat it in the second select.– Florida
The first would be only with the categories, only the
d0
, the second with the selected d0 sub-areas, ranging from thed0
until the next.– Florida
It doesn’t matter much how it is, since when selected a category, the second select lists the subforums belonging to it, and then choose in the second select.
– Florida
A function could remove the existing select, once it has taken the data, then create the first select of the categories, and the second one with the id we want. Wouldn’t that work? @dvd
– Florida
If it is not harmful to the display of the subareas it can be yes, in case it gets in the way, any name can be used, because for vbulletin what will import is the
id="destforumid" name="destforumid"
that will be in the second select.– Florida
Blz, I’m gonna do it here and when I get it we see.
– Sam
Another question: can be with jQuery?
– Sam
It can be whatever you want it to be :)
– Florida
You can repeat it, that is, it would be its own value in the second select.
– Florida