Require authors to fill in background, literature, problem, method, and interests when submitting ideas #72

Merged
niat8586 merged 7 commits from student-idea-form-required-fields into develop 2025-01-17 09:45:28 +01:00
Showing only changes of commit 57e6f5c1cc - Show all commits

View File

@ -18,6 +18,7 @@ import org.apache.wicket.model.*;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.model.util.SetModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.value.IValueMap;
import org.apache.wicket.validation.validator.StringValidator;
import se.su.dsv.scipro.components.*;
import se.su.dsv.scipro.generalsystemsettings.GeneralSystemSettings;
@ -187,7 +188,17 @@ public class ProjectIdeaSubmissionPanel extends GenericPanel<Idea> {
LambdaModel.of(getModel(), Idea::getProjectType, Idea::setProjectType),
projectTypes,
new LambdaChoiceRenderer<>(ProjectType::getName, ProjectType::getId)
);
) {
@Override
protected IValueMap getAdditionalAttributes(int index, ProjectType choice) {
IValueMap valueMap = super.getAdditionalAttributes(index, choice);
// Have to remove the client side validation for required
// to have this field behave like all the others on the form.
// Can't remove the call to #setRequired(true) as it is needed for server side validation.
valueMap.remove("required");
return valueMap;
}
};
projectTypeChoice.add(
new AjaxFormChoiceComponentUpdatingBehavior() {
@Override