I have a category selector with up to 4 level depth. The selectable values are stored in one table. This Table has the values: id, parentId, level and a label. This builds a hierarchical structure.
- 1 Root Category
- — 2. Sub Category
- —- 3. Sub Sub Category
- —— 4. Sub sub sub Category
Now I want to have 4 select fields. Only the first is activated the others are hidden and deactivated. If this one is selected, the second gets filtered/updated by the first and activated. … and so on. I only want to return the id of the deepest category as my selected category. However some categories only have 2 or 3 levels. If the form loads it should refill itself backwards from the selected field by knowing its level and getting its parents.
Does such a selector already exist? Do you have examples?
Since couple of people already asked whether I solved the problem. Yes, I’m using xtemplate and only have one selector showing the structure.