Forums / Setup & design / Edit content from Frontend layout

Edit content from Frontend layout

Author Message

Robin Sørlie

Wednesday 13 October 2004 6:59:03 am

To get an edit link I use the following:
{section show=$node.object.can_edit}
<a href={concat("content/edit/",$node.object.id)|ezurl}>[Edit]</a>
{/section}

When I enter this, I get the /content/edit and the right object ID. I can change the content in the forms as I do in adnin. But when I click "Send for publish" button, I get the following error:

Den plasseringen ble ikke validert
- Ingen hovednode er valgt, vennligst velg en hovednode.

Translated into english this should be something like this:

That placement was not validated.
- No main node is chosen, please choose a main node.

Now I'm stuck, and don't understand why this doesn't work.

Ole Morten Halvorsen

Wednesday 13 October 2004 7:30:46 am

Hi,

The object doesn't have a main placement. You can set this as a hidden variable. Normally edit_placement.tpl would take care of this, but I guess you don't include that file.

The solution is documented in the Bulding an eZ publish site tutorial:
http://ez.no/ez_publish/documentation/building_an_ez_publish_site/the_guestbook/the_input_template

Basicly what you have to do is add this to your edit template:

<input type="hidden" name="MainNodeID" value="{$main_node_id}" />

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Robin Sørlie

Wednesday 13 October 2004 8:04:01 am

After my last message, I came to think of the edit_placement.tpl

I use the standard edit.tpl as an override, and had commented out edit_placement and edit_right_menu cause the users don't need this to edit the content, and will only cause confusion.

When I used the edit_placement, it worked, and also using your suggestion with an hidden form field. So this is great, thanks.

But I now have a bigger problem. I tried to edit a few objects before, and got that error I described. On those objects the error still apperes, but not only at the frontend, but ALSO in admin! So I have no possibility to change this objects anymore. This has probably something to do with cache, but I have cleared all cahce through admin, but it's still the same. Any suggestion on this? Delete the /var/cache/ ?