In my current form, the structure is as follows:
kingdom --> phylum --> class --> order --> family --> genus...
If the kingdom = Animalia
, then the options for phylum
should be a specific list.
Similarly, if the phylum
is set to Chordata
, the next dropdown input should have a predefined list of choices.
This pattern continues with conditions based on the values selected in the previous levels, creating a hierarchical form with interdependent levels.
I have explored various examples and attempted to implement them, but I am unable to find a suitable solution. Any thoughts or suggestions would be greatly appreciated.
Below is the HTML code using Bootstrap:
<div class='col-12 left'>
<div class='form-group'>
<label for='uname'>kingdom</label>
<select class="form-control" name='kingdom'>
<option>Animalia</option>
<option>Plantae</option>
<option>Fungi</option>
<option>Protista</option>
<option>Monera</option>
</select>
<div class='valid-feedback'>Valid.</div>
<div class='invalid-feedback'>Please fill out this field.</div>
</div>
</div>
<div class='col-12 left'>
<div class='form-group'>
<label for='uname'>phylum/division</label>
<select class="form-control" name='phylum'>
<option>Chordata</option>
<option>Annelid</option>
<option>Arthropod</option>
<option>Bryozoa</option>
<option>Cnidaria</option>
<option>Echinoderm</option>
<option>Mollusc</option>
<option>Nematode</option>
<option>Platyhelminthes</option>
<option>Rotifer</option>
<option>Sponge</option>
</select>
// More code here...