AW: [Zope3-Users] clearing grouped widgets in z3c.form

Roger Ineichen dev at projekt01.ch
Fri Mar 7 06:36:06 EST 2008


Hi John

I think that's a question for Stephan

> Betreff: Re: [Zope3-Users] clearing grouped widgets in z3c.form
> 
> Widgets are cleared because after zope processes the editform 
> (with Done or Delete button pressed), the selectedItem in the 
> table becomes None, so the addform is then displayed.  In the 
> example, the addform and editform have distinct prefixes, so 
> their fields have distinct names in the request object.  In 
> particular, the editform doesnt set any of the addform's 
> fields in the request object, so the addform returns with 
> empty/default field values.
> 
> The problem is that widgets of grouped fields get the 
> BaseForm's "form." 
> prefix, so the group's widgets in the edit and add forms have 
> the same key in the request object and thus the editform's 
> grouped widgets are named the same as the addform's widgets, 
> so those widget's editform values show up in the addform.  
> (In contrast, non-grouped widgets have the "add." vs "edit." 
> prefix of their parent form.)

I guess, not sure for groups, but normaly sub forms get prefixed 
with both prefixes. This means a sub form uses 'form.edit' if 
the parent form has a prefix of 'form' and the subform has a 
prefix of 'edit'.

Regards
Roger Ineichen



More information about the Zope3-users mailing list