added condition to check if add or edit. Changes submit/update button based on condition