Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Submit a preview only when valid dates are entered

Dombi Attila77148198d0a1
diff --git a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
index 1d2c278a0e6..379910295e6 100644
--- a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
@@ -56,7 +56,9 @@ export default class ProjectLifeCyclesFormController extends FormPreviewControll
super.connect();
this.previewForm = debounce(() => {
- void this.submit();
+ if (this.dateInputFieldsAreValid) {
+ void this.submit();
+ }
}, 300);
const context = await window.OpenProject.getPluginContext();
@@ -134,6 +136,10 @@ export default class ProjectLifeCyclesFormController extends FormPreviewControll
}
}
+ private get dateInputFieldsAreValid():boolean {
+ return this.dateInputFields.every((field) => field.value === '' || this.toDate(field.value));
+ }
+
private get dateInputFieldsToUpdate():HTMLInputElement[] {
if (this.highlightedField) {
return [this.highlightedField];