AnsweredAssumed Answered

Want to hide some fields from advance search form

Question asked by shashank.tyagi on Aug 21, 2018
Latest reply on Aug 22, 2018 by shashank.tyagi

Hi,

 

I have created a customModel and using this custom model to customise advance search.

 

my customModel.xml:

 

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- Custom Model -->

<!-- Note: This model is pre-configured to load at startup of the Repository. So, all custom -->
<!-- types and aspects added here will automatically be registered -->

<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!-- Optional meta-data about the model -->
<description>Custom Model</description>
<author></author>
<version>1.0</version>

<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>

<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace custom.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="custom.model" prefix="custom"/>
</namespaces>
<constraints>
<constraint name="custom:productListConstraint" type="LIST">
<parameter name="allowedValues">
<list>
<value>policyNumber</value>
<value>ClaimNumber</value>
<value>DocumentId</value>
</list>
</parameter>
</constraint>
</constraints>

 

<types>
<type name="custom:protocollazione">
<title>Protocollo</title>
<parent>cm:content</parent>
</type>
<type name="custom:marketingDoc">
<title>MyCompany Marketing Document</title>
<parent>custom:protocollazione</parent>
<properties>
<property name="custom:smartSearch">
<type>d:text</type>
<multiple>true</multiple>
<constraints>
<constraint ref="custom:productListConstraint" />
</constraints>
</property>
</properties>
</type>
<type name="custom:white">
<title>MyCompany Whitepaper</title>
<parent>custom:marketingDoc</parent>
</type>
</types>

 

<aspects>
<aspect name="custom:numP">
<title>Numero Protocollazione</title>
<properties>
<property name="custom:numeroP">
<title>Numero</title>
<type>d:int</type>
</property>
</properties>
</aspect>
</aspects>
</model>

 

 

 

and my custom-model-context.xml:

 

 

 

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
</bean>

</beans>

 

In share-config i added the form label smart search:

 

<config evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<!-- Forms for the advanced search type list -->
<forms>
<!--
The 'form' config element contains the name of the model type
of the form to display.

The element supports the following optional attributes:
id = form id, the id of "search" will be assumed if not set
label = label text to display - defaults to model type if not set
labelId = I18N message id of label text to display
description = description text to display
descriptionId = I18N message id of description text to display
-->
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>
<form label="smart search" description="search document by matadata">custom:white</form>
</forms>
</advanced-search>
</config>

 

Below is the screenshot of my customised advanced search:

 

 My requirement is to hide other fields except custom:smartSearch.

 

In this smart search form custom:smartSearch field is visible. My requirement is- I need only custom:smartSearch field and hide other fields i.e Created Date, Creator, Name, Locale, Modifier, etc.

I don't know how to hide these fields

 

Can anyone help me to hide Created Date, Creator, Name, Locale, Modifier, etc. fields except custom:smartSearch

Outcomes