cancel
Showing results for 
Search instead for 
Did you mean: 

Making a form for custom content types

brunoais
Champ in-the-making
Champ in-the-making
I have already made a custom content type with the help of:
"Working with Custom Content Types" by Jeff Pots
and now i wanted to do something a bit more that the document itself says that it is outside the objective of the document itself.

The objective is to make a form just like there is to create, for example, a .txt file.

For now, I was able to add the form to the menu but I'm still unable to get it to work.

When I click in the menu option I'm sent to a page with this (in red):

[blockquote]Form definition could not be found[/blockquote]

The [strong]tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml[/strong] contains (note these are only excerpts):

<xml>
   <config evaluator="node-type" condition="scSmiley TongueroductRelated">
      <forms>
         <form>
            <edit-form template="/forms/create_create.ftl" />
         </form>
      </forms>
   </config>
</xml>

<xml>
  <config evaluator="string-compare" condition="DocumentLibrary">
      <create-content>
         <content id="webable" mimetype="text/plain" label="create" itemid="scSmiley TongueroductRelated" icon="ax"/>
      </create-content>
</xml>

and [strong]tomcat/shared/classes/alfresco/web-extension/create_create.ftl[/strong] and [strong]tomcat/shared/classes/alfresco/web-extension/forms/create_create.ftl[/strong] and [strong]tomcat/shared/classes/alfresco/site-webscripts/create_create.ftl[/strong] and [strong]tomcat/shared/classes/alfresco/site-webscripts/forms/create_create.ftl[/strong] have as content:

<xml>
<#import "/org/alfresco/components/form/form.lib.ftl" as formLib />
<#if error?exists>
   <div class="error">${error}</div>
<#elseif form?exists>

   <#assign formId=args.htmlid + "-form">
   <#assign formUI><#if args.formUI??>${args.formUI}<#else>true</#if></#assign>

   <#if formUI == "true">
      <@formLib.renderFormsRuntime formId=formId />
   </#if>
  
   <div id="${formId}-container" class="form-container">
     
      <#if form.showCaption?exists && form.showCaption>
         <div id="${formId}-caption" class="caption"><span class="mandatory-indicator">*</span>${msg("form.required.fields")}</div>
      </#if>
        
      <#if form.mode != "view">
         <form id="${formId}" method="${form.method}" accept-charset="utf-8" enctype="${form.enctype}" action="${form.submissionUrl}">
      </#if>
     
      <div id="${formId}-fields" class="form-fields">
        <#list form.items as item>
            <#if item.kind == "set">
               <@renderSetWithColumns set=item />
            <#else>
               <@formLib.renderField field=item />
            </#if>
         </#list>
      </div>
        
      <#if form.mode != "view">
         <@formLib.renderFormButtons formId=formId />
         </form>
      </#if>

   </div>
</#if>

<#macro renderSetWithColumns set>
   <#if set.appearance?exists>
      <#if set.appearance == "fieldset">
         <fieldset><legend>${set.label}</legend>
      <#elseif set.appearance == "panel">
         <div class="form-panel">
            <div class="form-panel-heading">${set.label}</div>
            <div class="form-panel-body">
      </#if>
   </#if>
  
   <#list set.children as item>
      <#if item.kind == "set">
         <@renderSetWithColumns set=item />
      <#else>
         <#if (item_index % 2) == 0>
         <div class="yui-g"><div class="yui-u first">
         <#else>
         <div class="yui-u">
         </#if>
         <@formLib.renderField field=item />
         </div>
         <#if ((item_index % 2) != 0) || !item_has_next></div></#if>
      </#if>
   </#list>
  
   <#if set.appearance?exists>
      <#if set.appearance == "fieldset">
         </fieldset>
      <#elseif set.appearance == "panel">
            </div>
         </div>
      </#if>
   </#if>
</#macro>
</xml>
(yes, the file is in multiple places)


I'm following this wiki article:
http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Fforms-custom-f...

Help please!
3 REPLIES 3

mitpatoliya
Star Collaborator
Star Collaborator
First of all you need to edit your post.
Put all code between "code" tags.
And clarify your issue and steps followed.

brunoais
Champ in-the-making
Champ in-the-making
[blockquote]Put all code between "code" tags.[/blockquote]
I did, here's a copy/paste of the source code of the post:
http://pastebin.com/x6Hf1w1K

And clarify your issue and steps followed.

For now, I'm just trying to learn how Alfresco works so I'm working on copy/paste information and then test to see the results.
There are no real "steps" procedure, I just placed information in the .xml file as described in the wiki page and the pdf guide I linked.
Otherwise, I didn't understand about your question about the steps procedure.

brunoais
Champ in-the-making
Champ in-the-making
Help please (BUMP) I'm still in the same state.