From dea45f467f87edaabdd70989a1b7a78132616823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=84=EC=A3=BC?= Date: Thu, 26 Jun 2025 15:53:30 +0900 Subject: [PATCH] =?UTF-8?q?[FO]=20kri.form.maxlength=20=EB=B0=A9=EC=8B=9D?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ui/commonUtil.js | 17 ++++++++----- .../templates/info/bank/inputForm.html | 4 ++-- .../templates/info/bank/outputForm.html | 4 ++-- .../templates/info/monthly/form.html | 12 +++++----- .../resources/templates/info/user/user.html | 8 +++---- .../templates/record/expense/form.html | 6 ++--- .../templates/record/farming/form.html | 4 ++-- .../templates/record/forestry/form.html | 4 ++-- .../templates/record/income/form.html | 10 ++++---- .../templates/record/power/form.html | 4 ++-- .../resources/templates/record/work/form.html | 24 +++++++++---------- 11 files changed, 51 insertions(+), 46 deletions(-) diff --git a/front/src/main/resources/static/ui/commonUtil.js b/front/src/main/resources/static/ui/commonUtil.js index 7e60c2b7..6506dcfe 100644 --- a/front/src/main/resources/static/ui/commonUtil.js +++ b/front/src/main/resources/static/ui/commonUtil.js @@ -246,10 +246,15 @@ kri.form.error = function(errorList){ } } -kri.form.maxlength = function(object){ - if (object.value.length > object.maxLength) { - object.value = object.value.slice(0, object.maxLength); - } -} - +$(function() { + $('body').on('input', 'input[type="number"]', function() { + let $el = $(this); + if ($el.val().length > $el.attr('maxlength')) { + $el.val($el.val().slice(0, $el.attr('maxlength'))); + } + if ($el.attr('inputmode') === 'numeric') { + $el.val($el.val().replace('.', '')); + } + }) +}) \ No newline at end of file diff --git a/front/src/main/resources/templates/info/bank/inputForm.html b/front/src/main/resources/templates/info/bank/inputForm.html index 525cde1a..ae59b020 100644 --- a/front/src/main/resources/templates/info/bank/inputForm.html +++ b/front/src/main/resources/templates/info/bank/inputForm.html @@ -121,7 +121,7 @@
+ inputmode="decimal" pattern="[0-9]*" maxlength="10" >