From 9ba3672be08416382275a3806d8bc39438d3b3d3 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. Signed-off-by: David Nind --- .../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 8379c7eea33..5325d247e7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormElement.vue @@ -15,6 +15,9 @@ :size="attr.size" :maxlength="attr.maxlength" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> @@ -25,6 +28,9 @@ :placeholder="attr.placeholder || attr.label" :required="attr.required ? true : false" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> @@ -37,6 +43,9 @@ :placeholder="attr.placeholder || attr.label" :required="attr.required ? true : false" :disabled="disabled" + :clearable=" + attr.clearable !== undefined ? attr.clearable : undefined + " @update:modelValue="checkForInputError()" /> -- 2.53.0