rewrite create function
completed create/edit function in tr