diff --git a/modules/ant_creationcategories/AdminAntCreationcategories.php b/modules/ant_creationcategories/AdminAntCreationcategories.php index 9396aeec..f9519f3d 100644 --- a/modules/ant_creationcategories/AdminAntCreationcategories.php +++ b/modules/ant_creationcategories/AdminAntCreationcategories.php @@ -344,22 +344,9 @@ class AdminAntCreationcategories extends AdminTab obj.append(html); } } - $(document).ready(function() { - $(\'#subcategories\').tagsInput({ - width: \'auto\', - defaultText:\'Nom\', - }); - $(\'#subcategories .tag a\').click(function(event) { - $(\'#div-families\').empty(); - }); - $(\'#subcategories2\').tagsInput({ - width: \'auto\', - defaultText:\'Nom\' - }); - - $(\'#id_parent\').trigger("change"); - $(\'#id_parent\').change(function(){ - var id_parent = $(\'#id_parent\').val(); + function changeSelectParent(){ + var id_parent = $(\'#id_parent\').val(); + if(id_parent != 0) { $.ajax({ url : \'/modules/ant_creationcategories/ajax.php\', type : \'POST\', @@ -374,6 +361,24 @@ class AdminAntCreationcategories extends AdminTab } } }); + } + } + $(document).ready(function() { + $(\'#subcategories\').tagsInput({ + width: \'auto\', + defaultText:\'Nom\', + }); + $(\'#subcategories .tag a\').click(function(event) { + $(\'#div-families\').empty(); + }); + $(\'#subcategories2\').tagsInput({ + width: \'auto\', + defaultText:\'Nom\' + }); + + changeSelectParent(); + $(\'#id_parent\').change(function(){ + changeSelectParent(); }) $(\'#form1 .js-switch\').change(function(){