Skip to content

Commit 3abdfd9

Browse files
EUI-3331 - problems with form submission. Make sure we submit all fields from the current and previous pages
1 parent 69ddb73 commit 3abdfd9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/shared/components/case-editor/case-edit-page/case-edit-page.component.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked {
291291
return this.eventTrigger.case_fields;
292292
}
293293

294+
private getCaseFieldsFromCurrentAndPreviousPages(): CaseField[] {
295+
const result: CaseField[] = []
296+
this.wizard.pages.forEach ( page => {
297+
if (page.order <= this.currentPage.order) {
298+
page.case_fields.forEach( field => result.push(field));
299+
}
300+
})
301+
return result;
302+
}
303+
294304
private buildCaseEventData(): CaseEventData {
295305
// Get hold of the fields specific to the current page that we're going to submit.
296306
const pageFormFields = this.formValueService.filterCurrentPageFields(this.currentPage.case_fields, this.editForm.value);
@@ -305,7 +315,8 @@ export class CaseEditPageComponent implements OnInit, AfterViewChecked {
305315
// Now add the remaining bits and pieces to the CaseEventData,
306316
// The event_data should be the full context of the event, including values from previous pages, but not labels
307317
caseEventData.event_data = this.editForm.value.data;
308-
this.formValueService.removeUnnecessaryFields(caseEventData.event_data, this.getCaseFields(), false, true);
318+
this.formValueService.removeUnnecessaryFields(caseEventData.event_data, this.getCaseFieldsFromCurrentAndPreviousPages(),
319+
false, true);
309320
caseEventData.event_token = this.eventTrigger.event_token;
310321
caseEventData.ignore_warning = this.ignoreWarning;
311322

0 commit comments

Comments
 (0)