update javascript for create,update flow