SolutionModel and addEmptyValue

I’ve got my dynamic combobox populate working with a custom value list (and there was great rejoicing amongst the programming staff).

What I would like to do now is render the value list so that there is no empty value appearing in the combobox - currently there is a ‘blank’ value showing up in the combobox.

I’ve tried setting the valuelist’s “.addEmptyValue” to 1 (and 0) and neither setting seems to make a difference - the result is a ‘blank’ value in the combobox.

var lv_valuelist = solutionModel.newValueList('user_queries', SM_VALUELIST.CUSTOM_VALUES);
lv_valuelist.separator = ' ';

lv_valuelist.addEmptyValue = 1;   // this is supposed to keep an empty value from appearing in the list
                                  // but it doesn't seem to work
  
var lv_values = globals.bizlogic_getSavedQueries(security.getUserName(), controller.getServerName());
lv_valuelist.customValues = lv_values;
var lv_form = solutionModel.getForm('seis_set_query');
var lv_field = lv_form.getField('fv_current_search');
lv_field.valuelist = solutionModel.getValueList('user_queries');

Any ideas ?

Mark

blank_entry_in_combobox.JPG

Hi Mark,

Does your dataset perhaps return an empty record ?
If not then it sure does look like a bug. Please then file a bugreport in the support system.

lv_valuelist.addEmptyValue = 1;
```What when you set it to:```
lv_valuelist.addEmptyValue = true;

Probably stupid comment but is the ‘Allow empty value’ checkbox checked? Or is this different when using the Solution Model? Is it necessary to use the Solution Model for this?

Probably stupid comment but is the ‘Allow empty value’ checkbox checked?
Or is this different when using the Solution Model?

It is different, with the solution model everything is coded. So the property is the same as using the checkbox in the designer.

Is it necessary to use the Solution Model for this?

Very good question. They should both have equal functionality so it is not really an alternative to bypass the issue. And no, it is not really necessary to use the solution model for this.

IT2Be:

lv_valuelist.addEmptyValue = 1;
```What when you set it to:```
lv_valuelist.addEmptyValue = true;

The value is an integer - I tried using TRUE and got an error.

I’m setting it to 1 because that is the value I found in the xml file for an existing valuelist where no empty value is permitted.

see the constants VALUELIST.EMPTY_VALUE_ALWAYS and EMPTY_VALUE_NEVER

you have to set those on it.
i will update the tooltip/sample for this.

Thanks for the info Johan!

Cheers
Mark