Forums / Setup & design / How to embed a new node edit/create form in a page

How to embed a new node edit/create form in a page

Author Message

Tuomo Syvänperä

Tuesday 23 September 2008 4:08:39 am

We have a site which has one section under which the pages all have a form displayed on the right column of the site. The form, once submitted, should create a new forum topic under a certain forum node. How can I achieve this? It seems that when I normally click the new topic - button on a forum view, ez creates a new topic node and the displays the edit form for that node. Now I would need a way to post the form and get the node created once it is posted.
Any way to achieve this ?

And also relating to this, how can I get a feedback form to come back to the same page it was displayed once it is submitted. Now, if I submit a information collector form, user is redirected to the "thank you page". But I have a page where the form is embedded in the page in the same way as above. And I need the form submit to come back to that page so I can just display a thank you - text above the form on the right column.

Ivo Lukac

Tuesday 23 September 2008 5:17:54 am

Hello Tuomo,

First part is tricky because edit form creates draft, so in your case every page view would create draft (it will slow down your web). Maybe there is some solution which uses AJAX or something similar to post custom form for object creation. Don't know of such solution yet, maybe someone else does.

For second part you have DisplaySettings section in collect.ini

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

André R.

Tuesday 23 September 2008 5:24:22 am

You should probably look into using the powercontent extension.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Tuomo Syvänperä

Tuesday 23 September 2008 5:39:12 am

Okay, thanks for these.. I'll take a look at that powercontent extension.
I was thinking about a way to circumvent this problem. I was thinking that maybe I could make the form that submits the topic information as a standard information collector and submit the info that way. But that would require that I have a workflow set up so that when that information is collected, the workflow would automatically create the topic node using the collected information. But that would require a trigger which gets fired when information collectors are sent. Is there such a trigger or how could I create one ?

Tuomo Syvänperä

Tuesday 23 September 2008 6:15:42 am

The powercontent - extension works pretty well. Now only problem is that if there are validation errors when the form is submitted, the user gets redirected to the edit page. Instead the user should stay on the same page and the errors should be shown on the right column above the form. Anyway to achieve this with powercontent ? Or do I have to start thinking about using ajax to submit and display the form ?

Wei Dai

Wednesday 24 September 2008 4:34:56 am

Hi, I also have questions on the second part.

Actually, embedded a form to another page, so one form can be used anywhere is very common. However, I don't know how to enable the validation function, as I have posted a message just before this to ask:

"validate when the form template is not loaded as full view?"
(http://ez.no/developer/forum/setup_design/validate_when_the_form_template_is_not_loaded_as_full_view). I really don't have a clear clue on how the name space in eZ template language works; some docs on some deprecated tags but not all.

And, I knew the DisplaySettings section in collect.ini, just specify the result as node. But, there is also no information on how to write "thank you" message in the same node template page. How do I check if the form has successfully submitted to "content/action"?

Really wish someone can shed some light on this. Thanks!

Certified eZ Publish 4 developer looking for develop information & collaboration.