I'm building a test tracking app. When tests fail, there are 13 data
elements that have to be researched to identify the source of the
error. I've defined my forms and to make things clear for the user
(and less code for me) I've defined a TranslationErrorType to replicate
for each of the errors. However, when I need to populate the data
elements in the FieldSets I can't figure out how to define my
parameters to the values options.
Below is a small sample that seems to show the problem:
###### How the form fields are defined
error_options = [(0, 'Present, correct'),
(1, 'Present, not correct'),
(2, 'Missing'),
(3, 'Not Applicable')]
class TranslateErrorType(widgets.WidgetsList):
""""""
status = widgets.SingleSelectField(options=error_options,
default=0)
found = widgets.TextField(label='Data Found:',
validator=validators.String())
correct = widgets.TextField(label='Correct Data:',
validator=validators.String())
class ClaimFormFields(widgets.WidgetsList):
"""Fields to enter a "bad" claim"""
tf = widgets.SingleSelectField(options=error_options, default=0)
name = widgets.FieldSet(legend='Name', fields=TranslateErrorType())
addr = widgets.FieldSet(legend='Address',
fields=TranslateErrorType())
# After defining a TableForm I try to populate the data elements like
this:
vals = dict(name_status=2, tf=2)
claim_form.display(value=vals))
# The tf field changes just fine. How to I access that "nested" status
field for the name though? Thanks!
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
-~----------~----~----~----~------~----~------~--~---