Skip to content

Commit

Permalink
Foms: re-enable max and min limits for Number fields(#1915)
Browse files Browse the repository at this point in the history
Co-authored-by: Ali Alam <[email protected]>
  • Loading branch information
ali-ichk and Ali Alam authored Mar 6, 2025
1 parent 460701b commit d7d1690
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Input/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
5 changes: 3 additions & 2 deletions src/Forms/Input/Number.template.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="flex-grow relative flex" >
<input type="text" <?= $attributes; ?>
class="w-full rounded-md border py-2 text-gray-900 placeholder:text-gray-500
<input type="number" <?= $attributes; ?>
min=<?= $min; ?> max=<?= $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" />
</div>

0 comments on commit d7d1690

Please sign in to comment.