PloneFormGen embedded view in iframe

Hi,

I would like to insert PloneFormGen form into an iframe on different third party sites, just as a common share widget. The use case is a petition using collective.megaphone. The form should be displayed, validated and thank you page displayed in embedded mode in the iframe.

It basically, works, I can use http://my.site/my-form/@@embedded as iframe source and the form is displayed and validated inside iframe, but as soon as the form is submitted, Thank you page is displayed inside iframe in full Plone layout including header, portlets etc. This is not what I really want. I'm looking for embedded version of thank you page.

I have created embed.js for IMegaphone which returns a snippet inserting an iframe into target page DOM. The iframe src points to custom template which returns just embedded version of the form

<div tal:define="form nocall:context/@@embedded"
     tal:content="structure form"></div>

If anyone wants to insert the form into own webpage, he can just add <script src="http://my.site/my-form/embed.js>.

That works well but I don't know how to handle the thank you page. I want the form work properly on master website so I can't use any thank you page override.

Thanks
Radim

Why don't you embed the form in your own site as well? That would allow you to strip the thank-you page down and get consistent displays everywhere.

Al little bit offyour exact question. But maybe leading to a different solution.

To deliver just the body of a page as content, you can force current Plone to deliver just the body of a page as content e.g. to fill iFrames

Just append [myURL]?ajax_load=1 to the myURL calling href attribute in the frameset when loading the frame content. Then you get just the bare body.

One caveat is for you that when Plone is filtering the body you have to take care that no links to css etc. are filtered out.

You can get the original styles and scripts appending
?ajax_load=1&ajax_include_head=1

See for example: - http://plone.org/?ajax_load=1

So make sure the thank-you page is loaded with this parameters as well (rewrite etc.) . No template needed at all.

A review of all this parameters was done by Alessandro Pisa at: http://blog.redturtle.it/2012/07/03/boxing-plone

Hi Guido,
that does not solve my problem or I didn't get it. Even if I create embedded version on own site, the thank you page is still displayed in full Plone layout. So, I can create a stripped-down template with <div tal:content="structure form/@@embedded" /> inside but as soon as the form is validated and submitted, the thank you page is displayed in full.

Honestly, I would like to use different version of thank-you page for the embedded version but in that case I would have to temporarily change 'thanksPageOverride" settings.

Thanks
Radim

Hi @acsr,
thanks, but I think this approach does not fit my use case. Thanks anyway I didn't know I can use it this way.

Radim

Hi!

you've to change the post action to a template that does not load the
full Plone layout. Use the override tab on PloneFormGen object to put
the name/address of the template.

I want to display thanks page in full layout if the form is processed on the "master" site so I can't change thanksPageOvereride

What I would expect from PFG is to use embedded version of thanks page in case of embedded form, so instead of traversing to thank-you page it should traverse to thank-you/@@embedded

On 15/10/14 09:28, naro wrote:

[naro] naro
http://mandrillapp.com/track/click/30171175/community.plone.org?p=eyJzIjoiNE4zYk04b2dhcjRuQnVaR3ZZWXA5UnZzOE9NIiwidiI6MSwicCI6IntcInVcIjozMDE3MTE3NSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvY29tbXVuaXR5LnBsb25lLm9yZ1xcXC91c2Vyc1xcXC9uYXJvXCIsXCJpZFwiOlwiMmU3OWMxMzVmNTk5NDFjZjkwMWQyNDhjYjViMjA3MmZcIixcInVybF9pZHNcIjpbXCIwZGI4OWM3Zjg1ZjI1Zjc5OTY2ZTI2YzVmOGVhYWJlMWJhMTI0MmM0XCJdfSJ9
October 15

I want to display thanks page in full layout if the form is processed on
the "master" site so I can't change thanksPageOvereride

The point is that you can override the thank-you page with a stripped
down version. But you need to embed the original form in your own side
as well, so that both the form and the thank-you load in an iframe
within a page that provides your chrome.

:*CU#

 Guido Stevens  |  +31.43.3618933  |  http://cosent.nl

 s o c i a l   k n o w l e d g e   t e c h n o l o g y