<?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 Share customization - Could not make the advanced searching with dropdown property to work? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101740#M29175</link>
    <description>&lt;P&gt;I am using Alfresco Community 5.2.&amp;nbsp;I used Alfresco Maven SDK 3.0 to generate AMPs for the repository tier and share UI tier. I did customization in the share config custom XML, etc.&lt;BR /&gt;&lt;BR /&gt;Say, custom type A has a dropdown property (through a custom aspect and constraints). (Only in the try-alfresco-tomcat, I am able to do the following). Now in the Advanced Search, the property shows up as a dropdown with all the values (because of the customization). The first value is preselected for the dropdown (as naturally expected).&lt;BR /&gt;&lt;BR /&gt;Now, whether I like it or not, it will become part of the search conditions (when I click search).&lt;BR /&gt;I cannot have it optionally in the search condition. Like, if I choose nothing, do not search by it. And if I choose a valid value from the dropdown, then search by it.&lt;BR /&gt;&lt;BR /&gt;This search behavior can be accomplished for the text box search fields, right?&lt;BR /&gt;How could I do the same for dropdown custom property.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2020 09:46:19 GMT</pubDate>
    <dc:creator>sepgs2004</dc:creator>
    <dc:date>2020-11-03T09:46:19Z</dc:date>
    <item>
      <title>Share customization - Could not make the advanced searching with dropdown property to work?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101740#M29175</link>
      <description>&lt;P&gt;I am using Alfresco Community 5.2.&amp;nbsp;I used Alfresco Maven SDK 3.0 to generate AMPs for the repository tier and share UI tier. I did customization in the share config custom XML, etc.&lt;BR /&gt;&lt;BR /&gt;Say, custom type A has a dropdown property (through a custom aspect and constraints). (Only in the try-alfresco-tomcat, I am able to do the following). Now in the Advanced Search, the property shows up as a dropdown with all the values (because of the customization). The first value is preselected for the dropdown (as naturally expected).&lt;BR /&gt;&lt;BR /&gt;Now, whether I like it or not, it will become part of the search conditions (when I click search).&lt;BR /&gt;I cannot have it optionally in the search condition. Like, if I choose nothing, do not search by it. And if I choose a valid value from the dropdown, then search by it.&lt;BR /&gt;&lt;BR /&gt;This search behavior can be accomplished for the text box search fields, right?&lt;BR /&gt;How could I do the same for dropdown custom property.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 09:46:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101740#M29175</guid>
      <dc:creator>sepgs2004</dc:creator>
      <dc:date>2020-11-03T09:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Share customization - Could not make the advanced searching with dropdown property to work?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101741#M29176</link>
      <description>&lt;P&gt;You have two options, either you can use a custom form template for that property that will display all the values with a "" (empty) option or add the "" (empty) in constraint list in content model you have defined.&lt;/P&gt;
&lt;P&gt;e.g., notice the empty &amp;lt;value&amp;gt;, this should resolve use case you have.&amp;nbsp; This is the simplest option.&lt;/P&gt;
&lt;PRE&gt;&amp;lt;constraint name="demo:trialProductList" type="LIST"&amp;gt;
      &amp;lt;parameter name="allowedValues"&amp;gt;
        &amp;lt;list&amp;gt;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;          &amp;lt;value&amp;gt;&amp;lt;/value&amp;gt;
&lt;/STRONG&gt;&lt;/FONT&gt;          &amp;lt;value&amp;gt;Trial30&amp;lt;/value&amp;gt;
          &amp;lt;value&amp;gt;Trial60&amp;lt;/value&amp;gt;
.......
        &amp;lt;/list&amp;gt;
      &amp;lt;/parameter&amp;gt;
    &amp;lt;/constraint&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you have to write a freemarker template, keep it in&amp;nbsp;&amp;lt;yourShareModule&amp;gt;\src\main\resources\alfresco\web-extension\site-webscripts\&lt;FONT color="#FF0000"&gt;com\demo\components\form\controls&lt;/FONT&gt;&amp;nbsp;directory for example and use it as a template for the properties where you want to see an additonal empty option. You can take reference of out of the box "&lt;A href="https://github.com/Alfresco/share/blob/develop/web-framework-commons/src/main/resources/alfresco/site-webscripts/org/alfresco/components/form/controls/selectone.ftl" target="_blank" rel="noopener nofollow noreferrer"&gt;selectone.ftl&lt;/A&gt;" template and create your custom template that shows a blank option to avoid first value by default selected.&lt;/P&gt;
&lt;P&gt;e.g.:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;field id="demo:trialProducts"&amp;gt;
   &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;lt;control
	  template="/com/demo/components/form/controls/select-menu-with-blank.ftl" /&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;
&amp;lt;/field&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Example of&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;select-menu-with-blank.ftl&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt; :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;#include "/org/alfresco/components/form/controls/common/utils.inc.ftl" /&amp;gt;

&amp;lt;#if field.control.params.optionSeparator??&amp;gt;
   &amp;lt;#assign optionSeparator=field.control.params.optionSeparator&amp;gt;
&amp;lt;#else&amp;gt;
   &amp;lt;#assign optionSeparator=","&amp;gt;
&amp;lt;/#if&amp;gt;
&amp;lt;#if field.control.params.labelSeparator??&amp;gt;
   &amp;lt;#assign labelSeparator=field.control.params.labelSeparator&amp;gt;
&amp;lt;#else&amp;gt;
   &amp;lt;#assign labelSeparator="|"&amp;gt;
&amp;lt;/#if&amp;gt;
&amp;lt;#if field.control.params.blankValueDefault??&amp;gt;
   &amp;lt;#assign blankValueDefault=field.control.params.blankValueDefault&amp;gt;
&amp;lt;#else&amp;gt;
   &amp;lt;#assign blankValueDefault="true"&amp;gt;
&amp;lt;/#if&amp;gt;

&amp;lt;#assign fieldValue=field.value&amp;gt;

&amp;lt;#if fieldValue?string == "" &amp;amp;&amp;amp; field.control.params.defaultValueContextProperty??&amp;gt;
   &amp;lt;#if context.properties[field.control.params.defaultValueContextProperty]??&amp;gt;
      &amp;lt;#assign fieldValue = context.properties[field.control.params.defaultValueContextProperty]&amp;gt;
   &amp;lt;#elseif args[field.control.params.defaultValueContextProperty]??&amp;gt;
      &amp;lt;#assign fieldValue = args[field.control.params.defaultValueContextProperty]&amp;gt;
   &amp;lt;/#if&amp;gt;
&amp;lt;/#if&amp;gt;

&amp;lt;div class="form-field"&amp;gt;
   &amp;lt;#if form.mode == "view"&amp;gt;
      &amp;lt;div class="viewmode-field"&amp;gt;
         &amp;lt;#if field.mandatory &amp;amp;&amp;amp; !(fieldValue?is_number) &amp;amp;&amp;amp; fieldValue?string == ""&amp;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;
         &amp;lt;/#if&amp;gt;
         &amp;lt;span class="viewmode-label"&amp;gt;${field.label?html}:&amp;lt;/span&amp;gt;
         &amp;lt;#if fieldValue?string == ""&amp;gt;
            &amp;lt;#assign valueToShow=msg("form.control.novalue")&amp;gt;
         &amp;lt;#else&amp;gt;
            &amp;lt;#assign valueToShow=fieldValue&amp;gt;
            &amp;lt;#if field.control.params.options?? &amp;amp;&amp;amp; field.control.params.options != ""&amp;gt;
               &amp;lt;#list field.control.params.options?split(optionSeparator) as nameValue&amp;gt;
                  &amp;lt;#if nameValue?index_of(labelSeparator) == -1&amp;gt;
                     &amp;lt;#if nameValue == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == nameValue)&amp;gt;
                        &amp;lt;#assign valueToShow=nameValue&amp;gt;
                        &amp;lt;#break&amp;gt;
                     &amp;lt;/#if&amp;gt;
                  &amp;lt;#else&amp;gt;
                     &amp;lt;#assign choice=nameValue?split(labelSeparator)&amp;gt;
                     &amp;lt;#if choice[0] == fieldValue?string || (fieldValue?is_number &amp;amp;&amp;amp; fieldValue?c == choice[0])&amp;gt;
                        &amp;lt;#assign valueToShow=msgValue(choice[1])&amp;gt;
                        &amp;lt;#break&amp;gt;
                     &amp;lt;/#if&amp;gt;
                  &amp;lt;/#if&amp;gt;
               &amp;lt;/#list&amp;gt;
            &amp;lt;/#if&amp;gt;
         &amp;lt;/#if&amp;gt;
         &amp;lt;span class="viewmode-value"&amp;gt;${valueToShow?html}&amp;lt;/span&amp;gt;
      &amp;lt;/div&amp;gt;
   &amp;lt;#else&amp;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;
      &amp;lt;#if field.control.params.options?? &amp;amp;&amp;amp; field.control.params.options != ""&amp;gt;
         &amp;lt;select id="${fieldHtmlId}" name="${field.name}" tabindex="0"
               &amp;lt;#if field.description??&amp;gt;title="${field.description}"&amp;lt;/#if&amp;gt;
               &amp;lt;#if field.control.params.size??&amp;gt;size="${field.control.params.size}"&amp;lt;/#if&amp;gt; 
               &amp;lt;#if field.control.params.styleClass??&amp;gt;class="${field.control.params.styleClass}"&amp;lt;/#if&amp;gt;
               &amp;lt;#if field.control.params.style??&amp;gt;style="${field.control.params.style}"&amp;lt;/#if&amp;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;
               &amp;lt;!-- Add a default blank option first, selected if there is no existing value --&amp;gt;
               &amp;lt;option value="" &amp;lt;#if blankValueDefault = "true" ||  !(fieldValue??)&amp;gt; selected="selected"&amp;lt;/#if&amp;gt;&amp;gt;&amp;lt;/option&amp;gt;
               &amp;lt;#list field.control.params.options?split(optionSeparator) as nameValue&amp;gt;
                  &amp;lt;#if nameValue?index_of(labelSeparator) == -1&amp;gt;
                     &amp;lt;#-- Additional double quotes for exact term query --&amp;gt;
                     &amp;lt;option value='"${nameValue?html}"'&amp;lt;#if blankValueDefault = "false" &amp;amp;&amp;amp; (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;
                  &amp;lt;#else&amp;gt;
                     &amp;lt;#assign choice=nameValue?split(labelSeparator)&amp;gt;
                     &amp;lt;option value='"${choice[0]?html}"'&amp;lt;#if blankValueDefault = "false" &amp;amp;&amp;amp; (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;
                  &amp;lt;/#if&amp;gt;
               &amp;lt;/#list&amp;gt;
         &amp;lt;/select&amp;gt;
         &amp;lt;@formLib.renderFieldHelp field=field /&amp;gt;
      &amp;lt;#else&amp;gt;
         &amp;lt;div id="${fieldHtmlId}" class="missing-options"&amp;gt;${msg("form.control.selectone.missing-options")}&amp;lt;/div&amp;gt;
      &amp;lt;/#if&amp;gt;
   &amp;lt;/#if&amp;gt;
&amp;lt;/div&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Nov 2020 22:21:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101741#M29176</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-11-03T22:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Share customization - Could not make the advanced searching with dropdown property to work?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101742#M29177</link>
      <description>&lt;P&gt;One problem I am facing is, since the property is defined as integer or numeric, I am seeing an exception thrown while loading the page. This exception is similar to numberformat exception (trying to convert the empty space into numeric)&lt;/P&gt;&lt;PRE&gt;&amp;lt;property name="demo:Year_Single"&amp;gt;
  &amp;lt;title&amp;gt;Fiscal Year&amp;lt;/title&amp;gt;
  &amp;lt;type&amp;gt;d:int&amp;lt;/type&amp;gt;
  &amp;lt;mandatory&amp;gt;false&amp;lt;/mandatory&amp;gt;
  &amp;lt;index enabled="true"&amp;gt;
    &amp;lt;tokenised&amp;gt;true&amp;lt;/tokenised&amp;gt;
    &amp;lt;facetable&amp;gt;true&amp;lt;/facetable&amp;gt;
  &amp;lt;/index&amp;gt;
  &amp;lt;constraints&amp;gt;
    &amp;lt;constraint ref="demo:yearValuesList" /&amp;gt;
  &amp;lt;/constraints&amp;gt;
&amp;lt;/property&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;And the year list is defined as a constraint&lt;/P&gt;&lt;PRE&gt;&amp;lt;constraint name="demo:yearValuesList" type="LIST"&amp;gt;
  &amp;lt;parameter name="allowedValues"&amp;gt;
  &amp;lt;list&amp;gt;
    &amp;lt;value&amp;gt;&amp;lt;/value&amp;gt;
    &amp;lt;value&amp;gt;2008&amp;lt;/value&amp;gt;
    &amp;lt;value&amp;gt;2009&amp;lt;/value&amp;gt;
    &amp;lt;value&amp;gt;2010&amp;lt;/value&amp;gt;
    &amp;lt;value&amp;gt;2011&amp;lt;/value&amp;gt;
    &amp;lt;value&amp;gt;2012&amp;lt;/value&amp;gt;
    …more...
  &amp;lt;/list&amp;gt;
&amp;lt;/parameter&amp;gt;
&amp;lt;parameter name="caseSensitive"&amp;gt;
  &amp;lt;value&amp;gt;true&amp;lt;/value&amp;gt;
&amp;lt;/parameter&amp;gt;
&amp;lt;parameter name="sorted"&amp;gt;
  &amp;lt;value&amp;gt;false&amp;lt;/value&amp;gt;
&amp;lt;/parameter&amp;gt;
&amp;lt;/constraint&amp;gt;&lt;/PRE&gt;&lt;P&gt;I could change the type to text. &lt;STRONG&gt;But, is there a way to deal with this numeric conversion issue?&lt;/STRONG&gt;&lt;BR /&gt;In regular web page frameworks, some negative number could be used to represent null or no selection.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 02:01:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101742#M29177</guid>
      <dc:creator>sepgs2004</dc:creator>
      <dc:date>2020-11-30T02:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Share customization - Could not make the advanced searching with dropdown property to work?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101743#M29178</link>
      <description>&lt;P&gt;I don't think so. You have empty value in the list and type is d:int hence error is expected. Either&lt;/P&gt;
&lt;P&gt;- convert the property to d:text&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;- remove empty from the constraint list and create a field template (e.g. custom template, selectone-with-blank.ftl) to show an additional empty value when share form loads.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;example of custom template:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="Example of custom template" href="https://github.com/rjmfernandes/share-custom-form-controls/blob/master/share-custom-fc-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/components/form/controls/filtered-selectone.ftl" target="_self" rel="nofollow noopener noreferrer"&gt;https://github.com/rjmfernandes/share-custom-form-controls/blob/master/share-custom-fc-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/components/form/controls/filtered-selectone.ftl&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 02:07:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101743#M29178</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-11-30T02:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Share customization - Could not make the advanced searching with dropdown property to work?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101744#M29179</link>
      <description>&lt;P&gt;Glad it worked for you. good luck&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/24818"&gt;@sepgs2004&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 21:16:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/share-customization-could-not-make-the-advanced-searching-with/m-p/101744#M29179</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-12-02T21:16:25Z</dc:date>
    </item>
  </channel>
</rss>

