- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 04:07 PM
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>
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 02:41 AM
For boolean fields I usually use a selectone control (instead of checkbox) and configure three options with "true", "false" and "" (empty string) as value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 02:41 AM
For boolean fields I usually use a selectone control (instead of checkbox) and configure three options with "true", "false" and "" (empty string) as value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 09:22 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 03:03 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 12:50 PM
Thanks Axel, now the form is working as we would like.
