bug fixing the issue reported at #20446
This commit is contained in:
parent
051e7c6063
commit
465c0b4db7
|
@ -4,6 +4,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.0.1-SNAPSHOT] - 2020-10-08
|
||||
|
||||
#### Bug fixes
|
||||
|
||||
[#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
|
||||
|
||||
|
||||
## [v1.0.0] - 2020-10-08
|
||||
|
||||
#### First release
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<name>Metadata Profile Form Builder</name>
|
||||
<description>
|
||||
The Metadata Profile Form Builder is a widget able to build dynamically a web form by reading "gCube Metadata Profile/s"
|
||||
|
|
|
@ -331,12 +331,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.setValue(0, "");
|
||||
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled", "disabled");
|
||||
tempListBox.setSelectedValue("Select " + field.getFieldName());
|
||||
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled",
|
||||
"disabled");
|
||||
}
|
||||
|
||||
// get vocabulary fields
|
||||
|
@ -772,11 +772,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;
|
||||
|
|
Loading…
Reference in New Issue