switch from a tab to another one

I have two tab: the first includes a list of contracts in a datagrid; the second includes a form that allow specific users to add new contracts.

How can I define that, when a user correctly add a new contract, the tab with the form close and the one with the list became active and the datagrid refresh?
I don’t know the exact ID of the tabs because they are added dinamically, but I know the name of the tab

Considering that my tabbar is called “tabbarHome” and that the content of the tab is a PHP file, I tried the following code in order to close the tab, but it doesn’t work

<script  src="dhtmlxSuite/dhtmlxTabbar/codebase/dhtmlxcommon.js"></script>
<script  src="dhtmlxSuite/dhtmlxTabbar/codebase/dhtmlxtabbar.js"></script>
<script type="text/javascript">
alert('"Contratto Personalizzato" inserito con successo!');
tabbarHome.removeTab(tabbarHome.getActiveTab(),true);
</script>

Error solved!!!
:smiley: