Problem with dynamic dropdown default value

Hy everyone, I have a dynamic dropdown that populates with different categories, Like Category A, Category B , Category C. The problem is that for every Category, if I don’t click on a specific element of that dropdown, it will have the value of all the elements.
For example:

Category A:
- Element 1
- Element 2
- Element 3
Category B:
- Element 1
- Element 2
- Element 3
if in the I choose from the dropdown Category B, the dynamic dropdown underneath with populate with the element and Element 1 will be selected, so I normally submit my service catalog order, but In the request information I find this
Category B ( as selected)
[[“Element 1”,“Element 1”], [“Element 2”,“Element 2”], [“Element 3”,“Element 3”]]

for Category A I have managed to set a default value in the code by adding

    dialog_hash = {
        'sort_by'            => "none",
        'data_type'       => "string",
        'required'         => true,
        'sort_order'      =>"ascending",
        'values'             => list,
        'default'            => "Element 1"
        'default_value' => "Element 1"
      dialog_hash.each { |key, value| @handle.object[key] = value }

    function = 'Category 1'
    function = $evm.root['dialog_function'] unless $evm.root['dialog_function'].nil?

The problem is this default value only works for Category 1, how do I set a default value for the other categories. I don’t know how to code in ruby, do I replicate this code for each category?

It sounds strange. Can you post the configuration of the dropdown? Do you have multi-select enabled?

With dynamic elements, you usually need one ruby method per dynamic element to populate the values

What miq version are you using?