From 3da0d5f55a0dc8b9c04cb271ea7d541c63c9e3a8 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 28 Aug 2024 11:57:18 +0700
Subject: <iman> update new register

---
 src-migrate/modules/register/components/FormBisnis.tsx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 3b8fdbfc..e2e021b3 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -328,11 +328,19 @@ const form: React.FC<FormProps> = ({ type, required, isPKP }) => {
           readOnly={required}
           placeholder='000.000.000.0-000.000'
           value={!required ? form.npwp : ''}
-          onChange={handleInputChange}
-          aria-invalid={isPKP && !required && !!errors.npwp}
+          maxLength={16}  // Set maximum length to 16 characters
+          onChange={(e) => {
+            if (!required) {
+              const value = e.target.value.replace(/\D/g, ''); // Remove non-digit characters
+              if (value.length <= 16) {
+                handleInputChange(e);
+              }
+            }
+          }}
+          aria-invalid={!required && !!errors.npwp}
         />
 
-        {isPKP && !required && !!errors.npwp && <span className="form-msg-danger">{errors.npwp}</span>}
+        {!required && !!errors.npwp && <span className="form-msg-danger">{errors.npwp}</span>}
       </div>
 
       <div>
-- 
cgit v1.2.3

