Weird form validation question

27 views
Skip to first unread message

termopro

unread,
Oct 9, 2014, 3:10:47 AM10/9/14
to django...@googlegroups.com
Hi,

I am building a user registration page. Page has a form where user can select his current state and city.

The problem with that is that i cannot load list of cities into the form when the page is being generated.
That's because i show the user only cities from his state, not all of them.

So i generate a form with a list of states and an empty 'cities'. When user selects one of the states, i populate 'cities' with ajax.

Everything works fine, except i don't know how to validate 'cities' correctly and show form errors.
What is the correct way of doing this ?

Sergiy Khohlov

unread,
Oct 9, 2014, 3:54:56 AM10/9/14
to django-users
Are you using form_valid method in view ?

Many thanks,

Serge


+380 636150445
skype: skhohlov

--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/25d67c01-df04-424c-9171-88def729d3a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

termopro

unread,
Oct 9, 2014, 4:23:11 AM10/9/14
to django...@googlegroups.com
I am using form.is_valid()

Sergiy Khohlov

unread,
Oct 9, 2014, 4:38:50 AM10/9/14
to django-users
could you please paste  code in form valid block ?

Many thanks,

Serge


+380 636150445
skype: skhohlov

Reply all
Reply to author
Forward
0 new messages