puska schrieb:
> class DataSelectForm(TableForm):
> 
>      fields=[HiddenField('sifra_pitanja',
> validator=validators.Int()),
>                 TextField('question',  label=_(u'Question')),
>                 SingleSelectField('answer_id',
> validator=validators.Int(), label=_(u'Answers'),
> options=rows(key_id))]
>     submit_text=_(u'Select')
> 
> dataselect_form=DataSelectForm

Two problems here: First, you should create a DataSelectForm *instance* 
in teh last line, not simply pass the *class* in your controller.

Second, when you define your form class/instance, you cannot set 
options=rows(key_id), since key_id is not known at that time. It is only 
known when the actualy request is made. So, when defining your form, set 
options to some dummy list with entries similar to those you're using. 
You can pass in the options only later when you know which key is 
actually used.

So, in your *controller*, evaluate which options you need by setting 
dataselect_options = dict(answer_id=rows(key_id)). Pass both, the form 
instance dataselect_form *and* the dataselect_options to your template. 
In the template, when displaying the form, give the display call the 
information about the options, like this:

<div py:replace="dataselect_form(options=dataselect_options)"/>

Hope that helps.

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to