Forums / Developer / 2 Form collection

2 Form collection

Author Message

Albert Balagueró

Wednesday 25 August 2010 4:08:03 am

Hello,
anybody knows if it's possible to have two forms in the same page?
If it's possible, how I may configure the feedback options for both?

Thank you.

Robin Muilwijk

Thursday 26 August 2010 11:27:57 am

Hi,

What is the purpose/goal of having 2 forms on one single page? Forms usually forward you to another page, so submitting one of the two will take you away from the second form? Or is there something specific that there needs to be 2 forms?

Thanks and regards, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Patrick Kaiser

Thursday 26 August 2010 1:49:59 pm

There are usecases where this can make sense, a newsletter subscription AND unsusbcription form on one page for example.

If want your forms to use custom templates, create and place them somewhere under templates/node/view/*, for example as myform1_embed.tpl.

In the template that renders the multiform page fetch the two form objects. Then use something like this to display the forms.

{def 
     $myFormNode1=fetch( 'content', 'node', hash( 'node_id', 96 ) )
     $myFormNode2=fetch( 'content', 'node', hash( 'node_id', 97 ) )
}

<h2>My first form</h2> 
{node_view_gui content_node=$myFormNode1 view='myform1_embed'}

<h2>My second form</h2>
{node_view_gui content_node=$myFormNode2 view='myform2_embed'

Let me know if this helped.


Best regards,

Patrick