cancel
Showing results for 
Search instead for 
Did you mean: 

Aikau add options to a select form control

nancygaillard
Champ on-the-rise
Champ on-the-rise
Hi,

I am working with Alfresco 5.0.d and Alfresco SDK 2.0. And I am French

I am testing creating a page with a form, modifying the controller of the "simple-page" page of a new share project.

My main problem is that I don't see how to add options to a select form control. When I run my project, i am able to see the select but it is empty.

Other problem :
I have seen this tutorial https://blogs.alfresco.com/wp/developer/2014/09/26/aikau-mini-examples-simple-form/
And looking at https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2f/root/projects/sling...
on the BaseFormControl.js and DojoSelect.js

but I can't find the equivalent for V5.0.d

There is my example :
<blockcode>
var select = "alfresco/forms/controls/DojoSelect";

var form = {
   name: "alfresco/forms/Form",
   config: {
      showOkButton: true,
      okButtonLabel: "Filtrer",
      showCancelButton: true,
      cancelButtonLabel: "Annuler",
     postUrl:"/share/page/dp/ws/simple-page",
      okButtonPublishTopic: "PUBLISH_TOPIC",
      okButtonPublishGlobal: true,
      widgets: []
   }
};
var tailleTc = {
   name: select,
   config: {
      fieldId:"TAILLETC",
      name:"tailletc",
      label: "Taille TC",
      description: "Taille du TC",
      widgets:[
         {
            value:"40",
            options : [
               { label: "40", value: "40"},
               { label: "20", value: "20"},
               { label: "Autre", value: "0"}
            ]
         }
      ]
   }
};
form.config.widgets.push(tailleTc);
model.jsonModel = {
   widgets: [
      form
   ]
};
</blockcode>

2 REPLIES 2

ddraper
World-Class Innovator
World-Class Innovator
You need to use "optionsConfig" and "fixed" for static options.

If you haven't already I'd suggest that you work your way through the Aikau tutorial on GitHub: https://github.com/Alfresco/Aikau/blob/master/tutorial/chapters/About.md

Also, the JSDoc for Aikau can be found here (this link goes straight to the BaseFormControl from which DojoSelect extends and provides example uses: http://dev.alfresco.com/resource/docs/aikau-jsdoc/BaseFormControl.html (the published JSDoc is always for the most recent version, but the examples shown still apply)

nancygaillard
Champ on-the-rise
Champ on-the-rise
It works perfectly, thank you