add validation empty field on create and update form

This commit is contained in:
Wikzyy
2025-03-17 11:06:58 +07:00
parent 075c89c163
commit aeea5c31af
14 changed files with 37 additions and 36 deletions

View File

@ -62,7 +62,7 @@ const AddDialog = () => {
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (formField.name === '' || formField.posto_adm_id === 0) {
if (formField.name.trim() === '' || formField.posto_adm_id === 0) {
setAlert({ show: true, message: 'Please fill in all required fields.' });
return;
}