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

OO-144: rewrite the validate methods of to take in account the error of the text fields

--HG--
branch : 80-patch
parent d4dbbc95
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,6 @@ import org.olat.core.gui.components.form.flexible.elements.RichTextElement; ...@@ -26,7 +26,6 @@ import org.olat.core.gui.components.form.flexible.elements.RichTextElement;
import org.olat.core.gui.components.form.flexible.elements.SingleSelection; import org.olat.core.gui.components.form.flexible.elements.SingleSelection;
import org.olat.core.gui.components.form.flexible.elements.TextElement; import org.olat.core.gui.components.form.flexible.elements.TextElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController; import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
...@@ -181,6 +180,8 @@ public class NodeConfigFormController extends FormBasicController { ...@@ -181,6 +180,8 @@ public class NodeConfigFormController extends FormBasicController {
// the short title is mandatory // the short title is mandatory
shortTitle.setErrorKey("nodeConfigForm.menumust", new String[] {}); shortTitle.setErrorKey("nodeConfigForm.menumust", new String[] {});
shortTitleOk = false; shortTitleOk = false;
} else if (shortTitle.hasError()) {
shortTitleOk = false;
} }
if (shortTitleOk && super.validateFormLogic(ureq)) { if (shortTitleOk && super.validateFormLogic(ureq)) {
shortTitle.clearError(); shortTitle.clearError();
......
...@@ -114,19 +114,25 @@ public class RepositoryEntryDetailsFormController extends FormBasicController { ...@@ -114,19 +114,25 @@ public class RepositoryEntryDetailsFormController extends FormBasicController {
@Override @Override
protected boolean validateFormLogic(UserRequest ureq) { protected boolean validateFormLogic(UserRequest ureq) {
// Check for empty display name // Check for empty display name
boolean allOk = true;
if (!StringHelper.containsNonWhitespace(displayName.getValue())) { if (!StringHelper.containsNonWhitespace(displayName.getValue())) {
displayName.setErrorKey("cif.error.displayname.empty", new String[] {}); displayName.setErrorKey("cif.error.displayname.empty", new String[] {});
return false; allOk = false;
} else if (displayName.hasError()) {
allOk = false;
} else {
displayName.clearError();
} }
displayName.clearError();
// Check for empty description // Check for empty description
if (!StringHelper.containsNonWhitespace(description.getValue())) { if (!StringHelper.containsNonWhitespace(description.getValue())) {
description.setErrorKey("cif.error.description.empty", new String[] {}); description.setErrorKey("cif.error.description.empty", new String[] {});
return false; allOk = false;
} else {
description.clearError();
} }
description.clearError();
// Ok, passed all checks // Ok, passed all checks
return super.validateFormLogic(ureq); 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