Skip to content

Commit

Permalink
set max length for cells form input
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Nov 11, 2023
1 parent 083a54f commit 213ba1f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/javascript/submission_form/text_step.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -38,7 +39,7 @@
@focus="$emit('focus')"
/>
<div
v-if="!isTextArea"
v-if="!isTextArea && field.type !== 'cells'"
class="tooltip"
:data-tip="t('toggle_multiline_text')"
>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 213ba1f

Please sign in to comment.