How search with a form with more than one checkboxes?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

How search with a form with more than one checkboxes?

Jump to solution

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>
1 Solution

Accepted Solutions
Highlighted
Master

Re: How search with a form with more than one checkboxes?

Jump 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.

View solution in original post

4 Replies
Highlighted
Master

Re: How search with a form with more than one checkboxes?

Jump 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.

View solution in original post

Highlighted
Member II

Re: How search with a form with more than one checkboxes?

Jump to solution

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?

Highlighted
Master

Re: How search with a form with more than one checkboxes?

Jump to solution

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.

Member II

Re: How search with a form with more than one checkboxes?

Jump to solution

Thanks Axel, now the form is working as we would like.