Added form error handling functions