On 09/05/2006, at 7:16, Andrew Grover wrote:
> Questions:
> 1) For what use is the hidden field intended?

Take a look at this ticket:
http://trac.turbogears.org/turbogears/ticket/654

> 2) On a validation error, how do I get the child widget (e.g. text)'s
> error message to show up by the AutoCompleteField? The only thing I
> can come up with is to check for tg_errors at the top of the edit
> controller, and flash the error. This doesn't seem right, compared to
> how nicely error messages for non-composite fields are displayed...

The AutoCompleteField is a CompoundWidget therefore it's validator  
must be a Schema.  The AutoCompleteField doesn't display validation  
errors for it's child widgets (text and id) so you need to "un-nest"  
the error so the form displays it. Try something like:

class AutoCompleteValidator(Schema):
        def _to_python(self, value, state):
                text = value['text_field_name']
                value['text_field_name'] = ValidatorForText.to_python(text)
                return value

If line 4 raises an Invalid exception, it will "belong" to the Schema  
associated to the whole AutoCompleteField so the error message should  
appear beside it in the form. Make sure to assign the text's value  
back to it's corresponding key in 'value' so you get the correct  
value dict back.

HTH,
Alberto

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

Reply via email to