Created write form function that accepts error message
Added error message for invalid date