cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Form - Rendering Associations

ghernando
Champ in-the-making
Champ in-the-making
My content model has an association.  I'm able to display the association data in the view and edit forms if I don't use a custom template for the layout.
But when I use the custom template, I see:

An error has occured in the Share component: /share/service/components/form.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 07050000 Failed to process template org/alfresco/components/form/form.get.html.ftl
Server: Alfresco Spring WebScripts - v1.0.0 (Release Candidate 2 785) schema 1,000
Time: Aug 5, 2011 4:46:05 PM
Click here to view full technical information on the error.
Exception: freemarker.template.TemplateException - Error executing macro: renderField required parameter: field is not specified.

The custom form template has the following markup.  Everything else in the form renders OK when I remove this markup specific to the association.
Is an 'association' not a field?

         <div class="full-width">
             <@formLib.renderField field=form.fields["prop_mymodel_peer"] />
         </div>

In the form definition I have:

…. 
           <edit-form template="custom-editform-mymodel.ftl" />
            <field-visibility>

               <show id="mymodel:peer" force="true" />
            </field-visibility>

            <appearance>

               <field id="mymodel:peer" label="Associations" set="File">
                    <control template="/org/alfresco/components/form/controls/association.ftl">
                     <control-param name="displayMode">items</control-param>
                     <control-param name="showTargetLink">true</control-param>
                     <control-param name="compactMode">false</control-param>
                     <control-param name="forceEditable">true</control-param>
                  </control>
               </field>
            </appearance>
         </form>
3 REPLIES 3

ghernando
Champ in-the-making
Champ in-the-making
Never mind.  I've got it working.

nunut
Champ in-the-making
Champ in-the-making
Hai ghernando

I am a newbie in alfresco and i have problem about association especially in alfresco share. I have search on the net but still can't figure it out. Can you explain it briefly how can i create and show content association in alfresco share. It will be great if you put some code so i can understand it quickly

Thanx so much for your help


Nunut

idwright
Star Collaborator
Star Collaborator
In case anybody looks at this in future the answer is that instead of:

<@formLib.renderField field=form.fields["prop_mymodel_peer"] />

you need to use

<@formLib.renderField field=form.fields["assoc_mymodel_peer"] />