cancel
Showing results for 
Search instead for 
Did you mean: 

selectone.ftl no available options

jnrbrle
Champ in-the-making
Champ in-the-making
Hi,

I've made a custom data list by following the example of Jeff Pots, and now i'm trying to make some further customization. To be more specific, I'm trying to make a simple select option.

This is the example, I was following:

https://forums.alfresco.com/forum/end-user-discussions/alfresco-share/custom-datalist-selectoneftl-1...

In the second comment, he didn't close the control tag, so after making the same mistake, my form broke. But when I close it, I don't get any options

http://prntscr.com/6alon4

Here is the code from share-custom-sample.xml:


<form>
        <field-visibility>
                <!– for the form creation we are showing everything except approved date –>
                <show id="gc:gcID" />
                <show id="gc:gcIDclient" />
                <show id="gc:gcMaker" />
                <show id="gc:gcQuantity" />
                <show id="gc:gcPrice" />
                <show id="gc:gcPriceMargin" />
                <show id="gc:gcDueDate" />
                <show id="gc:gcStatus" />
                <show id="gc:gcComments" />
                <show id="gc:gcAttachments" />
             </field-visibility>
             <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />

                <appearance>

                <field id="gc:gcIDclient">
                   <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                </field>

                <field id="gc:gcStatus">
                   <control template="/org/alfresco/components/form/controls/selectone.ftl" />
                   <control-param name="options">jedna,druha,tretia</control-param>
                </field>

                <field id="gc:gcComments">
                   <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                </field>

                <field id="gc:gcAttachments">
                <control>
                   <control-param name="startLocation">{doclib}</control-param>
                </control>
                </field>

                </appearance>
        </form>



basically, it's almost exact copy of Jeff's tutorial.

and the code from customModelContent.xml:


   <property name="gc:gcStatus">
      <title>Status</title>
      <type>d:text</type>
       <mandatory>false</mandatory>
       <multiple>false</multiple>
   </property>


I'm missing something, but I realy don't know what… Any ideas?

Thx

Jan
1 REPLY 1

nenad982
Champ on-the-rise
Champ on-the-rise
Hi,

you should have constraint list in the content model, something like this:



<constraints>
   <constraint name="abc:propertyConstraintList" type="LIST">
      <parameter name="allowedValues">
      <list>
               <value>one</value>
          <value>two</value>
          <value>three</value>
      </list>
      </parameter>
                <parameter name="caseSensitive">         
                    <value>true</value>
           </parameter>
   </constraint>
</constraints>



<property name="abc:customProp">
   <title>Custom Prop</title>
   <type>d:text</type>
   <mandatory>true</mandatory>
   <constraints>
      <constraint ref="abc:propertyConstraintList" />
   </constraints>
</property>


With this constraint in the model, and using selectone.ftl control, forms engine will recognize property as drop-down control on UI.