Affect default_value dropdown list


#1

Hi
I try to affect a default value when I select a value in my dropdown list but it does not work
Does someone help me ?

Thank you

dialog_field = $evm.object

if $evm.root[‘dialog_middleware’] == ‘wlp’ || ‘was’
dialog_field[‘default_value’] = 15
else
dialog_field[‘default_value’] = 20
end


#2

I think if $evm.root[‘dialog_middleware’] == ‘wlp’ || ‘was’ will always return true.

Try if $evm.root[‘dialog_middleware’] == ‘wlp’ || $evm.root[‘dialog_middleware’] == ‘was’


#3

Thank you for your answer but it doesn’t work… :frowning:
I don’t know why… Very strange


#4

FYI, I found. Here how I did :

values_hash = {}
middleware=$evm.root[“dialog_middleware”]

if middleware == “wlp” || “was”
values_hash[‘size_websphere’] = “15”
end

if middleware == “tomcat”
values_hash[‘size_tomcat’] = “20”
end

list_values = {
‘sort_by’ => :value,
‘data_type’ => :string,
‘required’ => true,
‘values’ => values_hash
}
list_values.each { |key, value| $evm.object[key] = value }