HSC COde edit and add new Hsc updated
This commit is contained in:
parent
62f7913076
commit
ffb1eaad8f
@ -895,6 +895,21 @@ const IsicHsCodes = () => {
|
||||
|
||||
const handleFormChange = (field) => (event) => {
|
||||
const value = event?.target?.value ?? event;
|
||||
|
||||
if (field === "weight") {
|
||||
// Allow only numbers + optional decimal
|
||||
if (!/^\d*\.?\d*$/.test(value)) return;
|
||||
|
||||
// Split integer & decimal parts
|
||||
const [intPart = "", decPart = ""] = value.split(".");
|
||||
|
||||
|
||||
if (intPart.length > 2) return;
|
||||
|
||||
|
||||
if (decPart.length > 10) return;
|
||||
}
|
||||
|
||||
setForm((prev) => ({ ...prev, [field]: value }));
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user