Fixing: listBox with empty selection

This commit is contained in:
Francesco Mangiacrapa 2021-02-08 13:16:03 +01:00
parent 588c5cd82b
commit 77010cc7d6
1 changed files with 5 additions and 4 deletions

View File

@ -309,11 +309,12 @@ public class MetaDataFieldSkeleton extends Composite{
if(field.isMultiSelection())
tempListBox.setTitle(TOOLTIP_MULTISELECTION);
// if it is not mandatory, add a disabled option
if(!field.getMandatory()){
// if it is not mandatory and not multi-selection, add a disabled option (placeholder)
if(!field.getMandatory() && !field.isMultiSelection()){
tempListBox.addItem("Select " + field.getFieldName());
tempListBox.setSelectedValue("Select " + field.getFieldName());
tempListBox.setValue(0, "");
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled", "disabled");
tempListBox.setSelectedValue("Select " + field.getFieldName());
}
// get vocabulary fields
@ -694,7 +695,7 @@ public class MetaDataFieldSkeleton extends Composite{
if(toReturn.get(0).equals(placeholder)){
GWT.log("Skipping placeholder: "+placeholder);
toReturn.clear();
toReturn.add("");
//toReturn.add("");
}
}
}