Is that possible to use a z3c form inside a tile?
I've manged to render the form but there is no parameters passed to the request.
It's rendered like that:
class MyTile(Tile):
def index(self):
return queryMultiAdapter((self.context, self.context.REQUEST), name='my_form')()
It seems that somewhere in the process, the request (self.request) has been changed. any idea?
I just had a similar need, this is what I've found out:
plone.app.blocks uses plone.subrequest to retrieve each tile in a "separate" request. The request query is lost during this process, but there's a hope: in your form class (rendered by the tile) you'll have request['PARENT_REQUEST'], which will have the query string.
In my case, I've updated my form class to have something like:
@tiberiuichim, @MartronicSA I would not recommend poking into request["PARENT_REQUEST"], but would make the form to post to tile URL (or to a named view with the form) and then possibly redirect back to the mosaic view with the form tile. That way form should be processed just normally.
@datakurre that means you can't split a form over many tiles I think. It's also limiting to always require a redirect. Is it unreasonable that the request passed into a tile is the same as the page itself?