Skip to content

Commit 77b2dba

Browse files
committed
Fixing the validation to only allow for one comma.
1 parent e90c7da commit 77b2dba

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

eform-client/src/app/modules/cases/components/case-elements/element-number/element-number.component.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,21 @@ export class ElementNumberComponent {
2525

2626
validateInput(e): boolean {
2727
const value = e.target.value + String.fromCharCode(e.keyCode);
28-
const rgx = /^(\d+,?(?:\d+,|\d*)+)$/;
29-
return !!value.match(rgx);
28+
let rgx = /^(\d+,?(?:\d+,|\d*)+)$/;
29+
if (value.match(rgx)) {
30+
if (value.includes(',')) {
31+
rgx = /(,)/g;
32+
const b = value.match(rgx);
33+
if (b.length > 1) {
34+
return false;
35+
} else {
36+
return true;
37+
}
38+
} else {
39+
return true;
40+
}
41+
} else {
42+
return false;
43+
}
3044
}
3145
}

eform-client/src/app/plugins/plugins.routing.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@ import {RouterModule, Routes} from '@angular/router';
33
import {AuthGuard} from 'src/app/common/guards';
44

55
export const routes: Routes = [
6-
// INSERT ROUTES HERE
6+
{
7+
path: "customers-pn",
8+
canActivate: [AuthGuard],
9+
loadChildren: "./modules/customers-pn/customers-pn.module#CustomersPnModule"
10+
},
11+
{
12+
path: "case-management-pn",
13+
canActivate: [AuthGuard],
14+
loadChildren: "./modules/case-management-pn/case-management-pn.module#CaseManagementPnModule"
15+
},
16+
{
17+
path: "machine-area-pn",
18+
canActivate: [AuthGuard],
19+
loadChildren: "./modules/machine-area-pn/machine-area-pn.module#MachineAreaPnModule"
20+
}
21+
// INSERT ROUTES HERE
722
];
823

924
@NgModule({

0 commit comments

Comments
 (0)