I have constructed a TurboGears form like that:

class MySchema(validators.Schema):
     """Validator schema for contact form."""
     first_field = validators.UnicodeString()
     second_field = ...

class MyFields(widgets.WidgetsList):
     """Simple widgets for contact form."""
     first_field = TextField(label="Name:")
     second_field = ...

my_form = TableForm(fields=MyFields(), validator=MySchema())

Now I wanted to replace some of the TextFields with AutoCompleteFields. 
I had hoped that I simply need to replace "TextField" in the code above 
with "AutoCompleteField" and add a search_controller parameter.

But unfortunately, AutoCompleteField is a CompoundWidget, so it returns 
a dictionary with two values. I.e. my validator does not fit any more, 
my label does not fit any more (the id is different), and the data I get 
back is now a dictionary with two values instead of a string.

So I need to rewrite everything just to change a TextField to a 
AutoCompleteField? Do I miss anything? This seems to be completely 
awkward to me. I thought TurboGears should be easier.

I noticed that I get a similar problem when I introduce fieldsets. Then 
my data is suddenly grouped in the same way, I have to create Schemas 
for every fieldset, flatten the whole structure to get the record in the 
database etc. I.e. again I have to adapt everything when I just want to 
put some fields in a fieldset as a visual clue for the user.

The whole concept of nesting data of CompoundWidgets seems to be 
completly awkward to me. Maybe there is something I don't understand? Is 
this solved differently in ToscaWidgets?

-- Chris

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