I have an advanced search form with three checkboxes properties, when I check just one of this property the results are of documents that has only the checked property. Is possibly to make a form that can search for all documents with one checked property, but not excluding the documents with others unchecked properties?
Below a snippet of my code:
Custom model
<types>
<type name="demo:demoPastaRH">
<title>Tipo Pasta RH</title>
<parent>cm:folder</parent>
<mandatory-aspects>
<aspect>demo:dadosFuncionario</aspect>
<aspect>demo:validacaoConteudoPastaRH</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="demo:dadosFuncionario">
<properties>
<property name="demo:cpfFuncionario">
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
</index>
</property>
</properties>
</aspect>
<aspect name="demo:validacaoConteudoPastaRH">
<properties>
<property name="demo:contemFRE">
<type>d:boolean</type>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
<tokenised>both</tokenised>
</index>
</property>
<property name="demo:contemContratoTrabalho">
<type>d:boolean</type>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
<tokenised>both</tokenised>
</index>
</property>
<property name="demo:contemAsoAdmissional">
<type>d:boolean</type>
<index enabled="true">
<atomic>true</atomic>
<stored>false</stored>
<tokenised>both</tokenised>
</index>
</property>
</properties>
</aspect>
</aspects>
Search Form
<config evaluator="model-type" condition="demo:demoPastaRH">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="cm:name" />
<show id="cm:description" />
<show id="demo:cpfFuncionario" force="true" />
<show id="demo:contemFRE" force="true" />
<show id="demo:contemContratoTrabalho" force="true" />
<show id="demo:contemAsoAdmissional" force="true" />
</field-visibility>
<appearance>
<field id="demo:cpfFuncionario">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="demo:contemFRE">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" >
<control-param name="mode">OR</control-param>
</control>
</field>
<field id="demo:contemContratoTrabalho">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" >
<control-param name="mode">OR</control-param>
</control>
</field>
<field id="demo:contemAsoAdmissional">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" >
<control-param name="mode">OR</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
Solved! Go to Solution.
For boolean fields I usually use a selectone control (instead of checkbox) and configure three options with "true", "false" and "" (empty string) as value.
For boolean fields I usually use a selectone control (instead of checkbox) and configure three options with "true", "false" and "" (empty string) as value.
Hi Axel,
Thanks for your answer, I try your solution and the behavior is working as need. But the options "true", "false" and "" are not that intuitive in my native language (Portuguese), there is a way to use other words in the droplist, like a key-value?
Those are just the values to be used in the backend. As you can see in the documentation for forms, a select list (selectone.ftl / selectmany.ftl) can contain localised display labels in its "options" parameter.
Thanks Axel, now the form is working as we would like.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.