diff --git a/lib/process-services/src/lib/i18n/en.json b/lib/process-services/src/lib/i18n/en.json
index 85c5023471..e0fd931a35 100644
--- a/lib/process-services/src/lib/i18n/en.json
+++ b/lib/process-services/src/lib/i18n/en.json
@@ -288,7 +288,9 @@
"ERROR": {
"LOAD_PROCESS_DEFS": "Couldn't load process definitions, check you have access.",
"START": "Couldn't start new process instance, check you have access.",
- "MAXIMUM_LENGTH": "Length exceeded, {{characters}} characters max."
+ "MAXIMUM_LENGTH": "Length exceeded, {{characters}} characters max.",
+ "SPACE_VALIDATOR": "Space is not allowed in the beginning or the end of the text.",
+ "PROCESS_NAME_REQUIRED": "Process name is required."
}
},
"PROCESS-ATTACHMENT": {
diff --git a/lib/process-services/src/lib/process-list/components/start-process.component.html b/lib/process-services/src/lib/process-list/components/start-process.component.html
index ec441f7560..cdec424956 100644
--- a/lib/process-services/src/lib/process-list/components/start-process.component.html
+++ b/lib/process-services/src/lib/process-list/components/start-process.component.html
@@ -43,13 +43,19 @@
{{ 'ADF_PROCESS_LIST.START_PROCESS.ERROR.MAXIMUM_LENGTH' | translate : { characters : maxProcessNameLength } }}
+
+ {{ 'ADF_PROCESS_LIST.START_PROCESS.ERROR.PROCESS_NAME_REQUIRED' | translate }}
+
+
+ {{ 'ADF_PROCESS_LIST.START_PROCESS.ERROR.SPACE_VALIDATOR' | translate }}
+
diff --git a/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts b/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts
index 7316bacb9d..1fab27e327 100644
--- a/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts
+++ b/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts
@@ -129,6 +129,17 @@ describe('StartFormComponent', () => {
expect(startBtn.disabled).toBe(true);
});
}));
+
+ it('should have start button disabled process name has a space as the first or last character.', async(() => {
+ component.processNameInput.setValue(' Space in the beginning');
+ component.processDefinitionInput.setValue(testProcessDef.name);
+ fixture.detectChanges();
+ const startBtn = fixture.nativeElement.querySelector('#button-start');
+ expect(startBtn.disabled).toBe(true);
+ component.processNameInput.setValue('Space in the end ');
+ fixture.detectChanges();
+ expect(startBtn.disabled).toBe(true);
+ }));
});
describe('with start form', () => {
diff --git a/lib/process-services/src/lib/process-list/components/start-process.component.ts b/lib/process-services/src/lib/process-list/components/start-process.component.ts
index e4821b46b5..94485c9bdb 100644
--- a/lib/process-services/src/lib/process-list/components/start-process.component.ts
+++ b/lib/process-services/src/lib/process-list/components/start-process.component.ts
@@ -117,7 +117,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
}
ngOnInit() {
- this.processNameInput = new FormControl(this.name, [Validators.required, Validators.maxLength(this.maxProcessNameLength)]);
+ this.processNameInput = new FormControl(this.name, [Validators.required, Validators.maxLength(this.maxProcessNameLength), Validators.pattern('^[^\\s]+(\\s+[^\\s]+)*$')]);
this.processDefinitionInput = new FormControl();
this.loadStartProcess();