From a3a8bb396b161c3246be1ba4f4767d9132d9036e Mon Sep 17 00:00:00 2001 From: Ali Alam Date: Thu, 6 Mar 2025 13:58:43 +0800 Subject: [PATCH] Forms: re-enable max and min limits for Number fields(#1915) Co-authored-by: Ali Alam --- CHANGELOG.txt | 1 + src/Forms/Input/Number.php | 2 +- src/Forms/Input/Number.template.php | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6c32e32680..ea80ea2c0d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -52,6 +52,7 @@ v29.0.00 Bug Fixes System: fixed issue with search terms containing a : full colon (special character) + System: Add max and min limits to form values Sidebar: fixed localization of Roles menu items. Activities: fixed activity missing from the timetable if it doesn't have a category Activities: fixed missing registration button for parents on View Activities page diff --git a/src/Forms/Input/Number.php b/src/Forms/Input/Number.php index 861339b2b4..78c6eee24e 100644 --- a/src/Forms/Input/Number.php +++ b/src/Forms/Input/Number.php @@ -110,6 +110,6 @@ protected function setValidation() */ protected function getElement() { - return Component::render(Number::class, $this->getAttributeArray() + []); + return Component::render(Number::class, $this->getAttributeArray() + ["min" => $this->min, "max" => $this->max]); } } diff --git a/src/Forms/Input/Number.template.php b/src/Forms/Input/Number.template.php index 44393e7b73..bf7a23e1e7 100644 --- a/src/Forms/Input/Number.template.php +++ b/src/Forms/Input/Number.template.php @@ -1,5 +1,6 @@
- - class="w-full rounded-md border py-2 text-gray-900 placeholder:text-gray-500 + + min= max= + class="w-full rounded-md border py-2 text-gray-900 placeholder:text-gray-500 focus:ring-1 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6" />