<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Alfresco Share custom search form - non-mandatory search field for constrained aspect in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28952#M12356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently working on defining search forms for my custom content model. In this model, I have an aspect (projectRelated) which allows the selection of a value (a project) from a constrained list. However, this is not a mandatory aspect, and not all of my documents will have a value for this aspect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This leads to a problem when configuring my search form for my custom content type. If I want to include this aspect as a searchable parameter, I currently have to choose a value from this list, which means any documents which don't have this aspect applied to them are automatically excluded from the search. I am looking for a way to search without having to set this value (e.g. by choosing an "unknown" or "none" value from the dropdown list). Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 May 2017 13:06:09 GMT</pubDate>
    <dc:creator>marcollirite</dc:creator>
    <dc:date>2017-05-02T13:06:09Z</dc:date>
    <item>
      <title>Alfresco Share custom search form - non-mandatory search field for constrained aspect</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28952#M12356</link>
      <description>Hi allI am currently working on defining search forms for my custom content model. In this model, I have an aspect (projectRelated) which allows the selection of a value (a project) from a constrained list. However, this is not a mandatory aspect, and not all of my documents will have a value for th</description>
      <pubDate>Tue, 02 May 2017 13:06:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28952#M12356</guid>
      <dc:creator>marcollirite</dc:creator>
      <dc:date>2017-05-02T13:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Share custom search form - non-mandatory search field for constrained aspect</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28953#M12357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to figure out a solution which involves creating a new freemarker template based on selectone.ftl. It uses the same code, but with an empty &amp;lt;option&amp;gt;&amp;lt;/option&amp;gt; tag included, as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;#include "/org/alfresco/components/form/controls/common/utils.inc.ftl" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;#if field.control.params.optionSeparator??&amp;gt;&lt;BR /&gt; &amp;lt;#assign optionSeparator=field.control.params.optionSeparator&amp;gt;&lt;BR /&gt;&amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;#assign optionSeparator=","&amp;gt;&lt;BR /&gt;&amp;lt;/#if&amp;gt;&lt;BR /&gt;&amp;lt;#if field.control.params.labelSeparator??&amp;gt;&lt;BR /&gt; &amp;lt;#assign labelSeparator=field.control.params.labelSeparator&amp;gt;&lt;BR /&gt;&amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;#assign labelSeparator="|"&amp;gt;&lt;BR /&gt;&amp;lt;/#if&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;#assign fieldValue=field.value&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;#if fieldValue?string == "" &amp;amp;&amp;amp; field.control.params.defaultValueContextProperty??&amp;gt;&lt;BR /&gt; &amp;lt;#if context.properties[field.control.params.defaultValueContextProperty]??&amp;gt;&lt;BR /&gt; &amp;lt;#assign fieldValue = context.properties[field.control.params.defaultValueContextProperty]&amp;gt;&lt;BR /&gt; &amp;lt;#elseif args[field.control.params.defaultValueContextProperty]??&amp;gt;&lt;BR /&gt; &amp;lt;#assign fieldValue = args[field.control.params.defaultValueContextProperty]&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt;&amp;lt;/#if&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="form-field"&amp;gt;&lt;BR /&gt; &amp;lt;#if form.mode == "view"&amp;gt;&lt;BR /&gt; &amp;lt;div class="viewmode-field"&amp;gt;&lt;BR /&gt; &amp;lt;#if field.mandatory &amp;amp;&amp;amp; !(fieldValue?is_number) &amp;amp;&amp;amp; fieldValue?string == ""&amp;gt;&lt;BR /&gt; &amp;lt;span class="incomplete-warning"&amp;gt;&amp;lt;img src="${url.context}/res/components/form/images/warning-16.png" title="${msg("form.field.incomplete")}" /&amp;gt;&amp;lt;span&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;span class="viewmode-label"&amp;gt;${field.label?html}:&amp;lt;/span&amp;gt;&lt;BR /&gt; &amp;lt;#if fieldValue?string == ""&amp;gt;&lt;BR /&gt; &amp;lt;#assign valueToShow=msg("form.control.novalue")&amp;gt;&lt;BR /&gt; &amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;#assign valueToShow=fieldValue&amp;gt;&lt;BR /&gt; &amp;lt;#if field.control.params.options?? &amp;amp;&amp;amp; field.control.params.options != ""&amp;gt;&lt;BR /&gt; &amp;lt;#list field.control.params.options?split(optionSeparator) as nameValue&amp;gt;&lt;BR /&gt; &amp;lt;#if nameValue?index_of(labelSeparator) == -1&amp;gt;&lt;BR /&gt; &amp;lt;#if nameValue == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == nameValue)&amp;gt;&lt;BR /&gt; &amp;lt;#assign valueToShow=nameValue&amp;gt;&lt;BR /&gt; &amp;lt;#break&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;#assign choice=nameValue?split(labelSeparator)&amp;gt;&lt;BR /&gt; &amp;lt;#if choice[0] == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == choice[0])&amp;gt;&lt;BR /&gt; &amp;lt;#assign valueToShow=msgValue(choice[1])&amp;gt;&lt;BR /&gt; &amp;lt;#break&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;/#list&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;span class="viewmode-value"&amp;gt;${valueToShow?html}&amp;lt;/span&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;label for="${fieldHtmlId}"&amp;gt;${field.label?html}:&amp;lt;#if field.mandatory&amp;gt;&amp;lt;span class="mandatory-indicator"&amp;gt;${msg("form.required.fields.marker")}&amp;lt;/span&amp;gt;&amp;lt;/#if&amp;gt;&amp;lt;/label&amp;gt;&lt;BR /&gt; &amp;lt;#if field.control.params.options?? &amp;amp;&amp;amp; field.control.params.options != ""&amp;gt;&lt;BR /&gt; &amp;lt;select id="${fieldHtmlId}" name="${field.name}" tabindex="0"&lt;BR /&gt; &amp;lt;#if field.description??&amp;gt;title="${field.description}"&amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;#if field.indexTokenisationMode??&amp;gt;class="non-tokenised"&amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;#if field.control.params.size??&amp;gt;size="${field.control.params.size}"&amp;lt;/#if&amp;gt; &lt;BR /&gt; &amp;lt;#if field.control.params.styleClass??&amp;gt;class="${field.control.params.styleClass}"&amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;#if field.control.params.style??&amp;gt;style="${field.control.params.style}"&amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;#if field.disabled &amp;amp;&amp;amp; !(field.control.params.forceEditable?? &amp;amp;&amp;amp; field.control.params.forceEditable == "true")&amp;gt;disabled="true"&amp;lt;/#if&amp;gt;&amp;gt;&lt;BR /&gt; &lt;STRONG&gt;&amp;lt;option&amp;gt;&amp;lt;/option&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt; &amp;lt;#list field.control.params.options?split(optionSeparator) as nameValue&amp;gt;&lt;BR /&gt; &amp;lt;#if nameValue?index_of(labelSeparator) == -1&amp;gt;&lt;BR /&gt; &amp;lt;option value="${nameValue?html}"&amp;lt;#if nameValue == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == nameValue)&amp;gt; selected="selected"&amp;lt;/#if&amp;gt;&amp;gt;${nameValue?html}&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;#assign choice=nameValue?split(labelSeparator)&amp;gt;&lt;BR /&gt; &amp;lt;option value="${choice[0]?html}"&amp;lt;#if choice[0] == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == choice[0])&amp;gt; selected="selected"&amp;lt;/#if&amp;gt;&amp;gt;${msgValue(choice[1])?html}&amp;lt;/option&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;/#list&amp;gt;&lt;BR /&gt; &amp;lt;/select&amp;gt;&lt;BR /&gt; &amp;lt;@formLib.renderFieldHelp field=field /&amp;gt;&lt;BR /&gt; &amp;lt;#else&amp;gt;&lt;BR /&gt; &amp;lt;div id="${fieldHtmlId}" class="missing-options"&amp;gt;${msg("form.control.selectone.missing-options")}&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt; &amp;lt;/#if&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then include this template in your search form for the relevant properties/aspects. This will generate an "empty" option in the dropdown list. Selecting this option means that the parameter will not be used as a search term for that particular query.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 May 2017 15:12:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28953#M12357</guid>
      <dc:creator>marcollirite</dc:creator>
      <dc:date>2017-05-03T15:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Share custom search form - non-mandatory search field for constrained aspect</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28954#M12358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or an even easier workaround would be adding&amp;nbsp;an empty value in the list constraint. It would have the same result in the end.&lt;/P&gt;&lt;P&gt;That is how I do that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2017 12:24:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28954#M12358</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2017-05-31T12:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Share custom search form - non-mandatory search field for constrained aspect</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28955#M12359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Douglas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your comment. I am not sure if I did something wrong but this was actually the first solution I tried, which gave me the problem that the search would only return documents which have the "empty value" as the value in the dropdown list (rather than returning all documents with any value, as I had desired).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2017 12:43:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28955#M12359</guid>
      <dc:creator>marcollirite</dc:creator>
      <dc:date>2017-05-31T12:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Share custom search form - non-mandatory search field for constrained aspect</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28956#M12360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but I missed your answer/question here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried using the select-many control inside the advanced-search form configuration, like this?&lt;/P&gt;&lt;PRE style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;lt;field id='my:lovproperty'&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;control template='/org/alfresco/components/form/controls/selectmany.ftl' /&amp;gt;&lt;BR /&gt;&amp;lt;/field&amp;gt;&lt;/PRE&gt;&lt;P&gt;That is what the following doc recommends:&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/docs/DOC-6013"&gt;Share Advanced Search&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can even use the following parameter to define the search operator used for this property:&lt;/P&gt;&lt;PRE style="color: #727174; border: 0px;"&gt;&amp;lt;control-param name='mode'&amp;gt;OR&amp;lt;/control-param&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2017 19:10:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-share-custom-search-form-non-mandatory-search-field-for/m-p/28956#M12360</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2017-06-23T19:10:17Z</dc:date>
    </item>
  </channel>
</rss>

