diff --git a/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.html b/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.html index f33bc04ebba..7f670d56d23 100644 --- a/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.html +++ b/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.html @@ -34,7 +34,7 @@
-
@@ -47,7 +47,7 @@
-
@@ -64,7 +64,7 @@ - minimum per option @@ -76,7 +76,7 @@ - maximum per option diff --git a/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.ts b/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.ts index df1a2c524e3..81224058e27 100644 --- a/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.ts +++ b/src/web/app/components/question-types/question-edit-details-form/constsum-options-question-edit-details-form.component.ts @@ -127,4 +127,18 @@ export class ConstsumOptionsQuestionEditDetailsFormComponent this.triggerModelChange('minPoint', undefined); } } + + restrictPointsLength(event : InputEvent, isMin : boolean, isMax : boolean) : void { + const target : HTMLInputElement = event.target as HTMLInputElement; + if (target.value != null && target.value.length > 9 && !isMin && !isMax) { + this.triggerModelChange('points', this.model.points); + target.value = target.value.substring(0, 9); + } else if (target.value != null && target.value.length > 9 && isMin) { + this.triggerModelChange('minPoint', this.model.minPoint); + target.value = target.value.substring(0, 9); + } else if (target.value != null && target.value.length > 9 && isMax) { + this.triggerModelChange('maxPoint', this.model.maxPoint); + target.value = target.value.substring(0, 9); + } + } } diff --git a/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.html b/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.html index 2969ee9589a..68a4bc9fb51 100644 --- a/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.html +++ b/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.html @@ -9,7 +9,7 @@
-
@@ -22,7 +22,7 @@
-
diff --git a/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.ts b/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.ts index b612217475a..e70865c9418 100644 --- a/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.ts +++ b/src/web/app/components/question-types/question-edit-details-form/constsum-recipients-question-edit-details-form.component.ts @@ -37,4 +37,12 @@ export class ConstsumRecipientsQuestionEditDetailsFormComponent : FeedbackConstantSumDistributePointsType.NONE, }); } + + restrictPointsLength(event : InputEvent) : void { + const target : HTMLInputElement = event.target as HTMLInputElement; + if (target.value != null && target.value.length > 9) { + this.triggerModelChange('points', this.model.points); + target.value = target.value.substring(0, 9); + } + } } diff --git a/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.html b/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.html index ce50ec942b3..8c28fc45fb4 100644 --- a/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.html +++ b/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.html @@ -1,7 +1,7 @@
Minimum value: -
@@ -11,7 +11,7 @@
Maximum value: -
diff --git a/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.ts b/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.ts index 6b8d6f1700b..20cc9c9dae1 100644 --- a/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.ts +++ b/src/web/app/components/question-types/question-edit-details-form/num-scale-question-edit-details-form.component.ts @@ -56,4 +56,15 @@ export class NumScaleQuestionEditDetailsFormComponent } return `[${possibleValuesString}]`; } + + restrictPointsLength(event : InputEvent, isMin : boolean) : void { + const target : HTMLInputElement = event.target as HTMLInputElement; + if (target.value != null && target.value.length > 9 && isMin) { + this.triggerModelChange('minScale', this.model.minScale); + target.value = target.value.substring(0, 9); + } else if (target.value != null && target.value.length > 9) { + this.triggerModelChange('maxScale', this.model.maxScale); + target.value = target.value.substring(0, 9); + } + } }