Forums / Setup & design / Trying to move an object via custom edit template

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Trying to move an object via custom edit template

Author Message

Arran Price

Tuesday 15 November 2005 2:36:28 pm

Hi,

This is hopefully quite simple, but Im having a brain block.

I have a custom class which can be:
created (works)
viewed (works)
archived (moves object to a new folder - dosent work)
by various users on the non admin interface so Ive created custom templates to do that.

I figure creation and archiving a form of edit - ie its just changing the default location/parent node of the object but I cant seem to make it work.

I basically want the view form to have an archive button, and went clicked it asks for confirmation (from an edit template) and then moves it.

code below if its a new form it gets user input - if its an existing form it shows the data and should submit with a move to the new location.




   <h1> Form Title </h1>

<form enctype="multipart/form-data"
      method="post"
      action={concat("/content/edit/",
                     $object.id,
                     "/",
                     $edit_version)|ezurl}>
                     
    
   {include uri="design:content/edit_validation.tpl"} 
   

   {* DETERMINE IF THIS EDIT IS A NEW FORM OR FOR ARHIVE *}
   
   
   
   {$content|attribute(show,1)}
   
   
    {section show=$content_attributes.0.has_content|not}
       {set newform=true}  {* NEW *}
    {section-else}
       {set newform=false} {* ARHIVE *}
    {/section}

   
   <table class="layout" border="0">                  
      {section name=ContentObjectAttribute loop=$content_attributes)}
      
        <tr> 
            <td> 
               <p><b><label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label></b></p></div>
               <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
               {section show=$newform|eq(true)}
                  {attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
               {section-else}
                  {attribute_view_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
               {/section}
            </td>
         </tr> 
      {/section}
   </table>
         
             archive node={$archive_node}               
         
         <div class="buttonblock">
            {section show=$newform|eq(true)}   
               <input class="defaultbutton"
                  type="submit"
                  name="PublishButton"
                  value="Submit"/>
            {section-else}
                <input class="defaultbutton"
                  type="submit"
                  name="PublishButton"
                  value="Confirm Archive"/>
            {/section}
               
               <input class="button"
                  type="submit"
                  name="DiscardButton"
                  value="Cancel" />
                  
                  
               {section show=$newform|eq(true)}   
                  <input type="hidden"
                     name="MainNodeID"
                     value="{$form_node}" />
               {section-else}
                  {* this is one of my attempts to make it work which was unsuccessful *}
                  <input type="hidden"
                     name="MainNodeID"
                     checked="checked"
                     value="{$archive_node}" />
               {/section}
          </div>
       </td>
      </tr>
    </table>
 </form>

the error I get on trying to move it is:

Location did not validate

    * No main node selected, please select one.

any help greatly appreciated.

cheers

Arran

addendum - Exponential 3.4.4 - Archive folder is fixed and $archived_node and $form_node are passed to this template (they are fixed, archive folder resides in the form folder)

Arran Price

Tuesday 15 November 2005 4:50:39 pm

fixed:
add

<input type="hidden" name="SetPlacementNodeIDArray[]" value="{$archive_node}" /> 

into the button block at the bottom of the template (for forms that arent new). also removed the checked line.

Arran