[Zope3-Users] Re: z3c.multiform ItemAction does not supply
action handler with all the data?
Alek Kowalczyk
thealx at poczta.onet.pl
Thu May 17 11:14:22 EDT 2007
Alek Kowalczyk <thealx at ...> writes:
>
> Hi,
>
> I'm not sure if it is an error or my mistake in using ItemAction.
>
> I have some multiform inheriting from GridItemFormBase.
> I had "Edit Items" and "Save Items" actions.
> They are implemented as <at> parentAction decorator.
> Now I decided that I want to have per-item actions
> (buttons displayed in subform row, not below the table).
> So I changed decorators to <at> itemAction.
>
> "Edit Item" still works fine (i.e enables edit mode for particular row),
> but "Save Item" stopped to work.
> It does not change values for the item to the ones entered in edit boxes.
> It seems that 'data' parameter after handleSubmit contains only
> 'selected' checkbox value, instead of all the data.
> For some reason validator does not load data from other widgets.
>
> Am I missing some important step in using <at> itemAction?
>
I found that when submitting "Save" action (i.e exit from Input Mode), then in
the FormBase.validate(self, action, data) function self.widgets contains:
(a) "Input" versions of my widgets if the handler decorator is @parentAction
(b) "Display" versions of my widgets if the handler decorator is @itemAction
Because of that, in (b) case the FormBase.validate code (below) does not load
data with the values supplied by user.
return (getWidgetsData(self.widgets, self.prefix, data)
+ checkInvariants(self.form_fields, data))
But still not sure if it is a bug, or I just use itemAction incorrectly.
Regards!
Alek.
More information about the Zope3-users
mailing list