You need some kind of ajax.
Once the user have entered their email, send a request to your django
app with only that email. Django check if the email exist and send a
reply with yes or no.

2016-11-01 3:30 GMT+01:00 pradam programming <[email protected]>:
> Thank you sir for the reply..
> But I am using HTML forms then what should I do...?  I want error message
> should display instantly when user enter existing mail id..!
>
>
> On 1 Nov 2016 12:05 am, "Andromeda Yelton" <[email protected]>
> wrote:
>>
>> If your model has the uniqueness constraint, you should get a form error
>> message automatically. If you don't want your model to have that constraint
>> but you still want your form to throw an error message, you can add a
>> clean_<name of email field> and a clean_<name of mobile field> function that
>> check for uniqueness and raise ValidationError if it fails (see examples
>> here: https://docs.djangoproject.com/en/1.10/ref/forms/validation/ ).
>>
>> When the form saves successfully, the user will be redirected to the
>> success_url you provide. That template can have success message text.
>> Alternately, in your form_valid function in the view, you could add a
>> success message that will get added to whatever page you're redirecting to
>> (as long as you make sure your template is rendering messages) ->
>> https://docs.djangoproject.com/en/1.10/ref/contrib/messages/#adding-a-message
>>
>> On Mon, Oct 31, 2016 at 1:55 AM, pradam programming
>> <[email protected]> wrote:
>>>
>>> Hi,
>>> Please I need an advice on the best approach to take on the following
>>> issues.
>>> I have create a form to save user details like first name,last
>>> name,email,mobile number etc...
>>>
>>> 1.Now I need to show error message (In Models i gave email and mobile no
>>> field as unique = True) when user enter a email id if email id exists in
>>> database show message like email id exists beside the email text field(also
>>> for  the mobile no) else proceed with form.
>>> 2.After i saving the form i need to show alert of success.
>>>
>>> regards,
>>> Pradam Abhilash
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAGGVXBOz6kQs%2BHhR%2BsrTUApOGnR7t50HHQuvSN_zJz6VMQosFw%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> --
>> Andromeda Yelton
>> Vice President/President-Elect, Library & Information Technology
>> Association: http://www.lita.org
>> http://andromedayelton.com
>> @ThatAndromeda
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFE1XCbVpkpOboCKR_Xck-oTm2NJYCVQ6ssWZsBWRaNe3pQM9Q%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGGVXBPwq%2BGaEkfFYRx%3Df3uL3Wzbh1xn5BLKdC7%2BCp_PHapBtQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTb0ZOGn%2BQyJrkjptjBN8O9BBSS-KWRAVA_19CaT3MWv0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to