Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Sorry, somehow I completely overlooked the post where it says you've solved the problem. Happy hacking! On Wed, May 23, 2012 at 10:52 AM, Kurtis Mullins wrote: > Hey, no problem! My apologies for missing out on this thread for a > while. I hope you got it figured out! > > Anyways, I'm thinking th

Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Hey, no problem! My apologies for missing out on this thread for a while. I hope you got it figured out! Anyways, I'm thinking that if you're actually basing this validation (done in your clean method), you may want to use a ForeignKey Field. You can define a custom queryset to filter through the

Re: how to get text of a ChoiceField populated with ajax

2012-05-17 Thread HDayi
hi curtis, sorry for being so late. on the page i have given the url, it's told exactly how you said. I have subclassed djangos choicefield and just changed validation method that always return true. so my own clean_fieldname method started to work fine. I am checking the returned valu if exis

Re: how to get text of a ChoiceField populated with ajax

2012-05-09 Thread Kurtis Mullins
Hey, It would help a lot to see your code posted to dpaste.com or somewhere. As far as grabbing the choices in your clean method, here's a little copy-and-paste from Django's own ChoiceField so you can see how they do it: class ChoiceField(Field): > > widget = Select > > default_error_mes

Re: how to get text of a ChoiceField populated with ajax

2012-05-09 Thread HDayi
hi again, finally i have solved the problem. I have found a web page saying you must create a custom choiceField class with a custom validation method. so i did that. http://blog.ikraftsoft.com/post/1342312823/django-form-choicefield-dynamic-values thx -- You received this message because yo

Re: how to get text of a ChoiceField populated with ajax

2012-05-09 Thread HDayi
hi Kurtis and Frances after populating the ChoiceField it looks like this First Second at first values were number but django form returns the value for this ChoiceField after validation. I don't have a clean_teacher method because i don't know what to do. i think the probl

Re: how to get text of a ChoiceField populated with ajax

2012-05-08 Thread Kurtis Mullins
cleaned_data should return the value of the field, not the index. Did you create your own clean__fieldname method? On Tue, May 8, 2012 at 11:35 AM, francescortiz wrote: > You have to make sure that the javascript code that populates the second > select box sets the value properly, or create a cus

Re: how to get text of a ChoiceField populated with ajax

2012-05-08 Thread francescortiz
You have to make sure that the javascript code that populates the second select box sets the value properly, or create a custom form validation (custom form/field clean methods). On Tuesday, May 8, 2012 5:59:19 AM UTC+2, HDayi wrote: > > hi people, > i am new to all of this. > i have a form wh

how to get text of a ChoiceField populated with ajax

2012-05-08 Thread HDayi
hi people, i am new to all of this. i have a form which has several selcet boxes. one is a ModelChoiceField gets school list from database. the other is only a ChoiceField and it's empty. when school is chosen i populate the ChoiceField using dajax. it works perfectly but... while validating the