Add Edit function. Fix the 'cancel' bug in forms.