# How do I change the message that pops up as a ValidationError in ModelForm field?

**URL:** <https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019>\
**Category:** Templates & Frontend\
**Created:** [July 25, 2022, 7:55am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019 "2022-07-25T07:55:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaw235](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/khaw235/32/6372_2.png) [@khaw235](https://forum.djangoproject.com/u/khaw235)\
**Post date:** [July 25, 2022, 7:55am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/1 "2022-07-25T07:55:34Z")

</div>

Hi there,

I have a ModelForm which have fields only from Model, no one it’s own. Now, I want to change the message that appears as `ValidationError` on the `EmailField`, when we miss the `@` symbol in email, see the screenshot below:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/e/e355dbe0ba09a3a2f380998d811f5190a656bff4.png)

I want to change the message encircled in red to `"Enter a valid email."`.

I did the following in my ModelForm:

```auto
from django.utils.translation import gettext as _

class MyModelForm(forms.ModelForm):
    class Meta:
        model = MyModel
        fields = ("email",)
        error_messages = {
            'email': {
                'invalid': _("Enter a valid email.")
            }
        }

```

But, it’s not working. Anyone knows how to change this message?

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [July 25, 2022, 10:23am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/2 "2022-07-25T10:23:36Z")

</div>

Hey there!  
The screenshot you just posted it’s not being provided by Django, but directly from the Browser.  
If you check this at HTML email validation you will going to see that’s the exact same message.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/b26d64d8587b2a14102f1a5b66152906f0b8c8c5.png)

So the form that you’re trying to submit, is not submitted because of this validator. The request is not even going to the server, and that’s good, because the browser will validate that the email is at least partially valid.

---

<div class="post-metadata">

**Author:** ![khaw235](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/khaw235/32/6372_2.png) [@khaw235](https://forum.djangoproject.com/u/khaw235)\
**Post date:** [July 25, 2022, 11:13am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/3 "2022-07-25T11:13:36Z")

</div>

@leandrodesouzadev I know that why the form is not being submitted. It’s not the issue. Actually, I want to change this validation message from `"Please include an '@' in the email address. 'emaiil' is missing an '@'." to just a simple message `“Enter a valid email.”`, that’s all I want to do right now. How can I accomplish this?

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [July 25, 2022, 11:19am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/4 "2022-07-25T11:19:20Z")

</div>

You can’t change that message.  
Do you want to do all the validation on the server rather than in the browser?

If so, you must override in the form the email field from `EmailField` to `CharField`. Then, for any value the form will be submitted, and then you can do your custom validation on your own.  
_Personally, I would not do that._

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 25, 2022, 11:31am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/5 "2022-07-25T11:31:43Z")

</div>

See [Client-side form validation - Learn web development | MDN](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation#using_built-in_form_validation) for how you can change that message and the limitations associated with doing so.

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [July 25, 2022, 11:43am UTC](https://forum.djangoproject.com/t/how-do-i-change-the-message-that-pops-up-as-a-validationerror-in-modelform-field/15019/6 "2022-07-25T11:43:22Z")

</div>

Oh i didnt know that, thanks @KenWhitesell!
