Skip to content

Fields syntax & examples

marrouchi edited this page Mar 5, 2016 · 4 revisions

In this page we will try to give you a reference about how to define form fields.

Select

Properties

  • choices : options for the select as {value1:text1,value2:text2,...}
  • value : default value for the selected option

Example :

form.fields.number({
    widget: form.widgets.select(),
    choices:(function(){ // Display select as a range from -50 to 50
        var range = [];
        var k=0;
        for (var v=-50;v<=50;v++) {
           range[k]=v;
           k++;
        }
        return range;
    })(),
    value: 50, // Default value
})
Clone this wiki locally