# setComboOptions

## Description

Allows users to set the values or options for a combo box component.

## Input / Parameter

| Name             | Description                                 | Input Type  | Default | Options | Required                       |
| ---------------- | ------------------------------------------- | ----------- | ------- | ------- | ------------------------------ |
| combo            | The name of the combo box component.        | String/Text | -       | -       | Partial (Yes if no 'comboId'.) |
| comboId          | The id of the combo box component.          | String/Text | -       | -       | Partial (Yes if no 'combo'.)   |
| data             | The list of options.                        | Array/List  | -       | -       | Yes                            |
| valueField       | The attribute name of the value inputs.     | String/Text | -       | -       | Yes                            |
| valueSeparator   | The separator used to separate the value.   | String/Text | -       | -       | No                             |
| displayField     | The attribute name of the dropdown values.  | String/Text | -       | -       | Yes                            |
| displaySeparator | The separator used to separate the display. | String/Text | -       | -       | No                             |

**\* Note:** Either combo or comboId must have value in order for this function to work.

## Output

N/A

Note: The component will be updated to show the combo box options.

## Callback

N/A

## Video

Coming Soon.

## Example

The user want to make a not visible component to visible.

### Step

1. Draw a combo box "ComboBox617", a button "setComboOptions".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-0193cfb95971b72e0a7c1d7e6e80ee4335f54fbe%2FsetComboOptions-step-1.png?alt=media)
2. Call the function

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-877a2dd6875610b7ea3913156ccf03d70c9510c6%2FsetComboOptions-step-2.png?alt=media)
3. Populate an array into data parameter by adding "toArray" & "toObject" functions.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-10f0793f99e7e52fa56c50a7126360765111fe09%2FsetComboOptions-step-3.png?alt=media)
4. Define the value field & display field.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-1489e6ce4dc990dc8a2ad0f463da62b761513b42%2FsetComboOptions-step-4.png?alt=media)

### Result

The combo box "ComboBox617" have the display values of "abc" & "dfe" & the value of "abc is 1, value of "dfe" is 2.

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-44a136c75c49d49b8d59754ef7e942548793210e%2FsetComboOptions-result-1.png?alt=media)

## Links
