From 2e1a59385d665e51bb147ab6837851d208ab250d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 1 Nov 2025 14:30:45 +0000 Subject: [PATCH] Bug 41151: Wire clearable prop through FormElement to input components This patch enables the clearable functionality in forms that use the BaseResource/FormElement pattern by passing the clearable attribute from field definitions through to the underlying input components. Changes: - Updated FormElement to pass clearable prop to InputText - Updated FormElement to pass clearable prop to InputNumber - Updated FormElement to pass clearable prop to TextArea The logic only passes clearable when explicitly defined in the field configuration, allowing the component's default (true) to apply when not specified. This means: - Fields without clearable attribute: clear button enabled (default) - Fields with clearable: false: clear button disabled - Fields with clearable: true: clear button explicitly enabled All text, number, and textarea fields in BaseResource forms (like agreements, packages, titles, etc.) now automatically get the clear button UX unless explicitly disabled. Example to disable for a specific field: { name: "my_field", type: "text", label: $__("My Field"), clearable: false, // Disable clear button for this field } This completes the clear button UX implementation across all form input patterns in the application. --- .../intranet-tmpl/prog/js/vue/components/FormElement.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue index 372d866900d..c8e14a49af5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue @@ -14,6 +14,9 @@ :required="attr.required ? true : false" :size="attr.size" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> @@ -24,6 +27,9 @@ :placeholder="attr.placeholder || attr.label" :required="attr.required ? true : false" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> @@ -36,6 +42,9 @@ :placeholder="attr.placeholder || attr.label" :required="attr.required ? true : false" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> -- 2.51.1