On Jun 8, 2011, at 8:03 PM, Noah Davis wrote:

> 
> 
> On Jun 7, 4:44 pm, "Diez B. Roggisch" <de...@web.de> wrote:
>> On Jun 7, 2011, at 9:58 PM, Noah Davis wrote:
>> 
>>> Adding strip_name=True to the form resulted in non-mangled field names
>>> ('firstname' rather than 'person_form.firstname'), but still allowed
>>> me to pre-populate the fields (which, as per the TW documentation, I
>>> was unable to do with unnamed widgets). This seems to have solved the
>>> immediate problem. As an aside, show_errors=True does not appear to
>>> function correctly under this circumstance, either. Thank you much for
>>> the help. And if there's any further testing I can help with...

ok, I think I fixed the bug. Could you use our version of tw.forms? I'll be 
backporting it to original tw.forms soonish, gotta check what differences there 
really are.

But there is a subtlety: due to the way tw.forms and ToscaWidgets in general 
works if it comes to request-values and errors, you can't use the 
@validate-decorators the way you do them now.

Because you put a widget into a hierarchy of another widget, TW clones it. So 
it becomes a different widget. Now if you use the original widget inside the 
@validate-decorator, but then display the different toplevel widget with the 
form being somewhere below it, you won't get any re-populated values or errors, 
for that matter.

So, your validate-decorator must look like this:

@validate(outer_widget.c.formname)

There is no way around that, if it were working with the original, we would 
re-introduce a bug I fixed 2 years ago where overlaps in form-field-names would 
result in clashes with value-repopulation and error-display.

HTH,

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com.
To unsubscribe from this group, send email to 
turbogears+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to