Changed alert() to a custom popup when submitting a message and error occur