From 213ba1ff5a66767e5d4a22457a9045d83959cf2c Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 12 Nov 2023 00:14:58 +0200 Subject: [PATCH] set max length for cells form input --- app/javascript/submission_form/text_step.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/javascript/submission_form/text_step.vue b/app/javascript/submission_form/text_step.vue index fac998848..9b88bb50e 100644 --- a/app/javascript/submission_form/text_step.vue +++ b/app/javascript/submission_form/text_step.vue @@ -15,6 +15,7 @@ v-if="!isTextArea" :id="field.uuid" v-model="text" + :maxlength="cellsMaxLegth" class="base-input !text-2xl w-full !pr-11 -mr-10" :required="field.required" :pattern="field.validation?.pattern" @@ -38,7 +39,7 @@ @focus="$emit('focus')" />
@@ -80,6 +81,19 @@ export default { } }, computed: { + cellsMaxLegth () { + if (this.field.type === 'cells') { + const area = this.field.areas?.[0] + + if (area) { + return parseInt(area.w / area.cell_w) + } else { + return null + } + } else { + return null + } + }, text: { set (value) { this.$emit('update:model-value', value)