CloudForms Now

Dialogs – Dynamic DropDowns

Its here and looks great. You can now populate a drop down list from an external source!

Simply create an Instance and Method, its advised you create a new Namespace to store dialog controls into rather than mixing them up into the general automation model.

The method requires the following code behind it;


dialog_field = $evm.object</code>

# sort_by: value / description / none
dialog_field["sort_by"] = "value"

# sort_order: ascending / descending
#dialog_field["sort_order"] = "ascending"

# data_type: string / integer
dialog_field["data_type"] = "integer"

# required: true / false
#dialog_field["required"] = "true"

#Return as a hash

dialog_field["values"] = {1 =&gt; "one", 2 =&gt; "two", 10 =&gt; "ten", 50 =&gt; "fifty"}

#Return as an array

dialog_field["values"] = [[1, "one"], [2, "two"], [10, "ten"], [50, "fifty"]]

dialog_field["default_value"] = 2

exit MIQ_OK

So the code is very simple, there are a number of settings you can control such as;

The the values are simply inserted into the drop down as EITHER a hash or array. The above example shows both, you would use either.

The next step is to create a dialog and add the element “Dynamic Dropdown List” to your form and set the NameSpace/Class/Instance to your Instance/Method you created in the previous step.

And what does it look like when finished?

The use cases for this are quite large, here are some;