completed create/edit function in tr