diff --git a/src/main/java/org/olat/ims/qti21/ui/editor/interactions/MatchScoreController.java b/src/main/java/org/olat/ims/qti21/ui/editor/interactions/MatchScoreController.java index 4c4924bb54611c1cab26947a046ab4802067a04f..6c451a1c2720f45a4e867176cb1c75b3f12c111f 100644 --- a/src/main/java/org/olat/ims/qti21/ui/editor/interactions/MatchScoreController.java +++ b/src/main/java/org/olat/ims/qti21/ui/editor/interactions/MatchScoreController.java @@ -38,6 +38,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.WindowControl; import org.olat.core.util.CodeHelper; +import org.olat.core.util.StringHelper; import org.olat.core.util.Util; import org.olat.course.assessment.AssessmentHelper; import org.olat.ims.qti21.model.xml.AssessmentHtmlBuilder; @@ -215,9 +216,23 @@ public class MatchScoreController extends AssessmentItemRefEditorController impl allOk &= validateDouble(maxScoreEl); if(assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) { - /*for(HotspotChoiceWrapper wrapper:wrappers) { - allOk &= validateDouble(wrapper.getPointsEl()); - }*/ + for(Map.Entry<DirectedPairValue, MatchScoreWrapper> entry:scoreWrappers.entrySet()) { + MatchScoreWrapper scoreWrapper = entry.getValue(); + TextElement scoreEl = scoreWrapper.getScoreEl(); + String val = scoreEl.getValue(); + scoreEl.clearError(); + if(StringHelper.containsNonWhitespace(val)) { + try { + Double.parseDouble(val); + } catch (NumberFormatException e) { + scoreEl.setErrorKey("error.double", null); + allOk &= false; + } + } else { + scoreEl.setErrorKey("form.legende.mandatory", null); + allOk &= false; + } + } } return allOk & super.validateFormLogic(ureq); diff --git a/src/main/java/org/olat/ims/qti21/ui/editor/interactions/_content/match_score.html b/src/main/java/org/olat/ims/qti21/ui/editor/interactions/_content/match_score.html index fe7a018065caec91ca09635be98954b429a2c8c0..56689877bf6d96efe3a93fae9931356fe4db25be 100644 --- a/src/main/java/org/olat/ims/qti21/ui/editor/interactions/_content/match_score.html +++ b/src/main/java/org/olat/ims/qti21/ui/editor/interactions/_content/match_score.html @@ -19,6 +19,9 @@ #if(${scoreWrapper.isCorrect()}) <i class=" o_icon o_icon-lg o_icon_accept"> </i> #end + #if($f.hasError("${sourceChoice.getChoiceIdentifier().toString()}-${targetChoice.getChoiceIdentifier().toString()}")) + <div>$r.render("${sourceChoice.getChoiceIdentifier().toString()}-${targetChoice.getChoiceIdentifier().toString()}_ERROR")</div> + #end </td> #end </tr>