Enumerate is a built-in function of python.
I think I used it here, since it was used this way in the tosca tutorial.

I tried a simple list and it works!

Thanks,
tamas

Pavel Strashkin wrote:
Hi Tamas,

What the "enumerate"? Is it your own type? Try to replace it with list
or tuple and check how it works.

2011/1/20 Tamas Hegedus <[email protected]>:
Hi,

I have a from with a single select field. At the first visit of the page the
options are in the select field. Other times they are there or not. E.g.
pressing the submit button with an empty textfield in the form, the form is
returned, but without selectable values in the select (so the select is
there, but no options).

Any idea? Thanks!
Tamas

(not the complete code)
-----------------------------
class BoxForm(TableForm):

   type_options = enumerate(('LN','-80C','-20C', '4C', 'RT'))

   fields = [
       SingleSelectField('type', options=type_options, default='LN',
validator=NotEmpty),
       TextField('name', validator=NotEmpty),
       ...
       ]
create_box_form = BoxForm("create_box_form", action="newbox_post")
-----------------------------
(root.py)
   @expose('tgmystorage.templates.newbox')
   @authenticate
   def newbox(self, **kw):
       tmpl_context.create_box_form = create_box_form
       return dict()

   #**************************
   @authenticate
   @validate(create_box_form, error_handler=newbox)
   @expose()
   def newbox_post(self, **kw):
       redirect(url("/browse"))

--
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.





--
Tamas Hegedus, PhD
Membrane Research Group        | phone: (36) 1-459 1500/60233
Hungarian Academy of Sciences  | fax:   (36) 1-266 6656
Tuzolto utca 37-47             | mailto:[email protected]
Budapest, 1094, Hungary        | http://www.hegelab.org

--
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