Re: Email validation in form

2017-09-13 Thread Melvyn Sopacua
First, make sure the field is rendered as an input tag with type "email". If it's not, your Django version is out of date or you're overriding the widget somewhere. Second, read this: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#Validation The standard pattern isn't good e

Re: Email validation in form

2017-09-13 Thread Moreplavec
Thanks. I made it as needed and wrote simple JS to call popup if there is an error to rise modal again after reload. Thanks! Dne úterý 12. září 2017 15:18:58 UTC+2 Daniel Roseman napsal(a): > > > On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: >> >> On Tuesday, 12 September 2

Re: Email validation in form

2017-09-12 Thread Moreplavec
I have {{ field.errors }} im my template. I changed model to not contain blank=True, but problem is still the same. Dne úterý 12. září 2017 15:18:58 UTC+2 Daniel Roseman napsal(a): > > > On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: >> >> On Tuesday, 12 September 2017 08:5

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: > > On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: >> >> >> >>> {% csrf_token %} >>> {{ form.non_field_errors }} >>> {% for hidden in form.hidden_fields %} >>>

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: > > > >> {% csrf_token %} >> {{ form.non_field_errors }} >> {% for hidden in form.hidden_fields %} >> {{ hidden }} >> {% endfor %} >>

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
If you render the form using the typical methods ("{{ form.as_p }}" or similar) then there should be a message over the email field with the error. >From the code, you an use form.errors to check the errors in the form. On Tue, Sep 12, 2017 at 8:10 AM, Moreplavec wrote: > I understand, but why

Re: Email validation in form

2017-09-12 Thread Moreplavec
I understand, but why while using model form it's not cought by form itself same as missing or incorect field like "asdf" for email? This is my problem. I need to show error and not to try to save :) Dne úterý 12. září 2017 12:47:16 UTC+2 Vijay Khemlani napsal(a): > > "asdf@asdf" is not a vali

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
"asdf@asdf" is not a valid email so form.is_valid returns False and form.save is never called On Tue, Sep 12, 2017 at 4:52 AM, Moreplavec wrote: > Greetings, > > i have strange problem with my model form. I have simple form for taking > orders, model looks like: > > class Order(models.Model):