fix js in new and edit templates