Dhtml tree duplicate children for the same parent

Hello,



I need to eliminate duplicate names for children having same parent in dhtml tree. For example:



PARENT

CHILD 1

CHILD 1 // should not be allowed.



Can you please give an example of how this can be accomplished on client side, prior to serialization and submitting XML to be processed on a server.



Thank you.

can be done as

var ids=tree.getAllSubItems(0).split(",")
var check={}
for (var i=0; i<ids.length; i++){
var label=tree.getItemText(ids[i]);
if (!check[label]) check[label]=true;
else tree.deleteItem(ids[i]); //delete duplicate
}