AnsweredAssumed Answered

Dynamic rendering of fields in a form

Question asked by fop6316 on Jul 31, 2012
Latest reply on Dec 12, 2012 by anhua-jian
Hi all,

My question is more or less in the title, I added a new data type in my data model.

<type name="moi:montype">
  <title>titre type</title>
  <parent>cm:content</parent>
  <mandatory-aspects>
    <aspect>moi:monaspect</aspect>
  </mandatory-aspects>
</type>

This one uses a new aspect in which I added a new field

<aspect name="moi:monaspect">
  <title>titre aspect</title>
  <properties>
    <property name="moi:monchamp">
      <type>d:text</type>
      <mandatory>false</mandatory>
    </property>
    …
  </properties>
</aspect>

I then displayed this new field in a Share form by editing the file share-config-custom.xml.

<config evaluator="node-type" condition="moi:montype">
  <forms>
    <form>
      <field-visibility>
        <show id="moi:monchamp"/>
        …
      </field-visibility>
      <appearance>
        <field id="moi:monchamp" label="Champ texte" />
        …
      </appearance>
    </form>
  </forms>
</config>

Till then, I could test my changes and the new field displays well.
But I would like to go further, and condition for example the display of the field depending on the logged in user's group.
If the logged in user is part of the "priviledged group", then the field is displayed, otherwise it will not, or only in read only mode.

Do you think we can do this ? And how ?
I looked at documentation, but can't find my happiness.
I don't ask for the full solution, but for tips to follow.

Thank you for your help.

Outcomes