create form and fixed bug for edit function