Skip to content
Snippets Groups Projects
Commit 8dc23fc2 authored by srosse's avatar srosse
Browse files

OO-2329: form is mandatory for assignment of type form and need to be checked

parent 110aab4d
No related branches found
No related tags found
No related merge requests found
......@@ -220,6 +220,7 @@ public class AssignmentEditController extends FormBasicController {
String editPage = Util.getPackageVelocityRoot(getClass()) + "/assignment_select_form.html";
selectFormLayout = FormLayoutContainer.createCustomFormLayout("selectFormLayout", getTranslator(), editPage);
selectFormLayout.setLabel("assignment.evaluation.form.entry", null);
selectFormLayout.setMandatory(true);
formLayout.add(selectFormLayout);
if(formEntry != null) {
String displayName = StringHelper.escapeHtml(formEntry.getDisplayname());
......@@ -358,6 +359,21 @@ public class AssignmentEditController extends FormBasicController {
allOk &= false;
}
}
typeEl.clearError();
selectFormLayout.clearError();
if(typeEl.isOneSelected()) {
AssignmentType type = AssignmentType.valueOf(typeEl.getSelectedKey());
if(type == AssignmentType.form) {
if(formEntry == null) {
selectFormLayout.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
}
} else {
typeEl.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
return allOk & super.validateFormLogic(ureq);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment