cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying Advanced Search form to include aspect properties

ashokharnal
Champ in-the-making
Champ in-the-making
I am trying to modify Advanced Search Form for Share.
In my data model, for  cm:content type, there is an aspect kb:articletype with
one of the properties as kb:recordid.

I want to search for values given to property kb:recordid. I have modified the
share-config-custom.xml file as follows:

<config evaluator="model-type" condition="cm:content">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <show id="kb:rbrecordid" />
            </field-visibility>
            <appearance>
               <field id="kb:rbrecordid" label="Record ID" >
      <control template="/org/alfresco/components/form/controls/textfield.ftl" />
      </field>
            </appearance>
         </form>
      </forms>
   </config>


Now when Alfresco is restarted, in the Alfresco Share, Advanced Search form,
besides the normal search fields of Keywords, Name, Title, Description, Mimetype,
Modifier date and Modifier, one other text box field with label "Record Id" appears.

However, a value in Record Id field is not returning any search results. Search result is 0.

Will be grateful to know what else to do to get the results?

Ashok Kumar Harnal
3 REPLIES 3

bertrandf
Champ on-the-rise
Champ on-the-rise
Hi,

See : http://wiki.alfresco.com/wiki/Forms#show

You just have to add :
force="true"

<show id="kb:rbrecordid" force="true" />

Regards

ashokharnal
Champ in-the-making
Champ in-the-making
Thanks.

I get the search results now.

Ashok Kumar Harnal

ashokharnal
Champ in-the-making
Champ in-the-making
Here is my complete code with some embellishments. Advanced Search is enabled
for eight properties of article aspect. In the search form two column of fields
are shown (template: 2-column-edit-form.ftl) and the set of fields are separated in a block
(through set id="myborder" …).  Width of two text-boxes is limited to 40px.

<!– Aspect properties in search form to be searched    –>
<config evaluator="model-type" condition="cm:content">
      <forms>
         <!– Search form –>
         <form id="search">
    <edit-form template="../documentlibrary/forms/2-column-edit-form.ftl" />
            <field-visibility>
      <!– kb:article aspect data –>
               <show id="kb:articletype" force="true"       />
          <show id="kb:filenumber"  force="true"       />
          <show id="kb:yearOfDocument" force="true"    />
          <show id="kb:endyearOfDocument" force="true" />
          <show id="kb:section" force="true"           />
          <show id="kb:rbrecordid" force="true"        />
          <show id="kb:plocation" force="true"         />
          <show id="kb:evidentialvalue" force="true"   />
            </field-visibility>
            <appearance>
      <set id="myborder" appearance="fieldset" label="Search on Main Attributes"   />
             <field id="kb:articletype" label="Document Type–Select one"  set="myborder" />
      <field id="kb:filenumber" label="File number" set="myborder"                 />
      <field id="kb:yearOfDocument" label="Beginnng Year of document/file" set="myborder" >
         <control template="/org/alfresco/components/form/controls/textfield.ftl"    >
            <control-param name="maxLength">4</control-param>
            <control-param name="size">4</control-param>
            <control-param name="style">font-weight: bold; font-family: arial; width: 40px</control-param>
         </control>
               </field>
      <field id="kb:endyearOfDocument" label="End Year of documents/file"  set="myborder" >
            <control template="/org/alfresco/components/form/controls/textfield.ftl" >
            <control-param name="maxLength">4</control-param>
            <control-param name="size">4</control-param>
            <control-param name="style">font-weight: bold; font-family: arial; width: 40px</control-param>
            </control>
               </field>
            <field id="kb:section" label="Section"  set="myborder" />
               <field id="kb:rbrecordid" label="Raksha Bhoomi record ID" set="myborder" >
         <control template="/org/alfresco/components/form/controls/textfield.ftl" >
            <control-param name="style">background-color: green; color: white; width: 90px </control-param>
         </control>
      </field>
      <field id="kb:plocation" label="Detailed property Location" set="myborder" />
               <field id="kb:evidentialvalue" label="Evidential Value" set="myborder" />
            </appearance>
         </form>
      </forms>
   </config>