The problem is that, when you submit the form to your view, the form choices
does not exist (the only exist only at client side, not server side).
Before validating the form, you have to create appropriate choices for that
choicefield.

This should point you to the right direction:
http://monogroncho.com/2008/10/django-gotchas-part-1/
    - look at the FORM SUBMISSION

This example is little bit complicated (can be done much easier, i think)
but as a guide it's very good.

Regards,
Radovan




newbie-15 wrote:
> 
> 
> Hi,
> 
>       I have created a form which contains a ChoiceField. But in the
> class of the form, I havent given
> 
> any choices to the ChoiceField. I'm creating the choices dynamically
> using ajax and adding it on
> 
> the client side using javascript. I'm also using is_valid function to
> check whether the input given to
> 
> the form is valid. All is well till there. But when I select a choice,
> I'm getting an exception saying
> 
> "Please provide valid input. That choice is not available in the
> choices". Can someone clarify me if
> 
> its wrong to add choices dynamically at the client side and select
> them as input. If so then how do
> 
> we solve this problem.
> 
> Thanks,
> Nazgi.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/error-using-ChoiceField-tp23968615p23975673.html
Sent from the django-users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to