Skip to content

Commit

Permalink
Can set max_char_limit null
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragchhatrala committed Nov 4, 2024
1 parent 692d21b commit 68d3798
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 2 additions & 3 deletions api/app/Http/Requests/UserFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function rules()

// Text field
'properties.*.multi_lines' => 'boolean|nullable',
'properties.*.max_char_limit' => 'integer|nullable|min:1|max:2000',
'properties.*.max_char_limit' => 'integer|nullable|min:1',
'properties.*.show_char_limit ' => 'boolean|nullable',
'properties.*.secret_input' => 'boolean|nullable',

Expand Down Expand Up @@ -133,8 +133,7 @@ public function messages()
return [
'properties.*.name.required' => 'The form block number :position is missing a name.',
'properties.*.type.required' => 'The form block number :position is missing a type.',
'properties.*.max_char_limit.min' => 'The form block number :position max character limit must be at least 1 OR Empty',
'properties.*.max_char_limit.max' => 'The form block number :position max character limit may not be greater than 2000.',
'properties.*.max_char_limit.min' => 'The form block number :position max character limit must be at least 1 OR Empty'
];
}
}
2 changes: 1 addition & 1 deletion client/components/open/forms/OpenFormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export default {
helpPosition: (field.help_position) ? field.help_position : 'below_input',
uppercaseLabels: this.form.uppercase_labels == 1 || this.form.uppercase_labels == true,
theme: this.theme,
maxCharLimit: (field.max_char_limit) ? parseInt(field.max_char_limit) : 2000,
maxCharLimit: (field.max_char_limit) ? parseInt(field.max_char_limit) : null,
showCharLimit: field.show_char_limit || false,
isDark: this.darkMode
}
Expand Down
10 changes: 8 additions & 2 deletions client/components/open/forms/fields/components/FieldOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,13 @@
name="max_char_limit"
native-type="number"
:min="1"
:max="2000"
:form="field"
label="Max character limit"
help="Maximum character limit of 2000"
:required="false"
@update:model-value="onFieldMaxCharLimitChange"
/>
<toggle-switch-input
v-if="field.max_char_limit"
name="show_char_limit"
:form="field"
class="mt-3"
Expand Down Expand Up @@ -833,6 +833,12 @@ export default {
},
updateMatrixField(newField) {
this.field = newField
},
onFieldMaxCharLimitChange(val) {
this.field.max_char_limit = val
if(!this.field.max_char_limit) {
this.field.show_char_limit = false
}
}
}
}
Expand Down

0 comments on commit 68d3798

Please sign in to comment.