cancel
Showing results for 
Search instead for 
Did you mean: 

Can't hide form fields

maurorestuccia
Champ in-the-making
Champ in-the-making
Hello
I defined "my_custom_type" in my model in which I included some aspects.
I' ve a form defined to these aspects.
Then I defined a form with evaluator "node-type" and condition "my_custom_type" where I've hidden some fields belonging to an aspect.
When I show this form, I see also the hidden fields.
How can I hide these fields?

I'm using Alfresco 4.2.e version.

Best Regards
Mauro 
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
First of all there are two type of config for content type
"node-type"-for created content
"model-type"-for new content

For aspect you have different config with condition "aspect" So properties of aspect are controlled by this config not type config.

Now your config is in effect or not that you can check if you are seeing extra properties like "modified-date" and all which you have not included in your form then it is not in effect.

maurorestuccia
Champ in-the-making
Champ in-the-making
Thank you Mitpatoliya,

Your answer is clear but my problem is another:

I defined "my_custom_type" in my model

      <type name="myNamespace:my_custom_type">
         <title>myNamespace:my_custom_typ</title>
         <parent>cm:folder</parent>
         <mandatory-aspects>
            <aspect>myNamespace:myAspectBase</aspect>
         </mandatory-aspects>
      </type>
   


"myAspectBase" is the following:

   <aspect name="myNamespace:myAspectBase">
         <title>myNamespace:myAspectBase</title>
         <properties>
            <property name="myNamespace:prop1" >
               <type>d:text</type>
            </property>
            <property name="myNamespace:prop2" >
               <type>d:text</type>
            </property>
         </properties>
   </aspect>


I have the necessity to show a form with only "prop2" and to hide "prop1":
In myShareConfig.xml file, I defined a form with evaluator "node-type" and condition "my_custom_type"

<config evaluator="node-type" condition="myNamespace:my_custom_type">
      <forms>
         <form>             
               <hide id="myNamespace:prop1" force="true" />
               <show id="myNamespace:prop2" force="true" />               
            </field-visibility>
            <appearance>               
                  <field id="myNamespace:prop1">
                     <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                  </field>
                  <field id="myNamespace:prop2">
                     <control template="/org/alfresco/components/form/controls/textarea.ftl" />                                 
                  </field>               
            </appearance>
         </form>
      </forms>
   </config>


I have also this form

<config evaluator="aspect" condition="myNamespace:myAspectBase">
      <forms>
         <form>             
               <show id="myNamespace:prop1" force="true" />
               <show id="myNamespace:prop2" force="true" />               
            </field-visibility>
            <appearance>               
                  <field id="myNamespace:prop1">
                     <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                  </field>
                  <field id="myNamespace:prop2">
                     <control template="/org/alfresco/components/form/controls/textarea.ftl" />                                 
                  </field>               
            </appearance>
         </form>
      </forms>
   </config>


When I show the form associated to "my_custom_type", I see also the field "prop1".

Can someone help me?
Regards
Mauro Restuccia

mitpatoliya
Star Collaborator
Star Collaborator
Change this in aspect form will be enough.


     <hide id="myNamespace:prop1" force="true" />
   <show id="myNamespace:prop2"/>           


You do not need to add aspect properties in custom type related config.
It will be picked up from aspect related config as I said earlier.
Also if you have noticed in your aspect config you have added both properties with "show-id" that is the reason prop1 is not hidden

I have the necessity to add the aspect "myAspectBase" to some documents and for these documents I have to show prop1. This is the reason for which prop1 has "show id" in my aspect config.

Regards
Mauro