[Helpers] Extended the form helper for better error handling within the logAndFlash method.