This commit is contained in:
Francesco Mangiacrapa 2021-02-08 11:13:31 +01:00
parent d235b81231
commit 588c5cd82b
3 changed files with 19 additions and 6 deletions

View File

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.6.2-SNAPSHOT] - 2021-02-08
**Bug Fixes**
[#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
## [v1.6.1] [r4.24.0] - 2020-06-18
**New Features**

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>1.6.1</version>
<version>1.6.2-SNAPSHOT</version>
<name>gCube Ckan metadata publisher widget</name>
<description>

View File

@ -679,7 +679,7 @@ public class MetaDataFieldSkeleton extends Composite{
toReturn.add(((TextBox)holder).getText());
else{
// handle multiselected case
// handle single and multi-selected case
for(int i = 0; i < ((ListBox)holder).getItemCount(); i++){
if(((ListBox)holder).isItemSelected(i)){
toReturn.add(((ListBox)holder).getItemText(i));
@ -687,11 +687,17 @@ public class MetaDataFieldSkeleton extends Composite{
}
// if it was not mandatory but there was no choice, returning empty string
if(!field.getMandatory())
if(toReturn.equals("Select " + field.getFieldName())){
toReturn.clear();
toReturn.add("");
if(!field.getMandatory()) {
//Task #20446 - bug fix. Ignoring the placeholder
if(toReturn.size()==1) {
String placeholder = "Select " + field.getFieldName();
if(toReturn.get(0).equals(placeholder)){
GWT.log("Skipping placeholder: "+placeholder);
toReturn.clear();
toReturn.add("");
}
}
}
}
break;