add validation empty field on create and update form
This commit is contained in:
@ -77,7 +77,7 @@ const EditDialog = () => {
|
||||
const handleUpdate = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (formField.name === '') {
|
||||
if (formField.name.trim() === '') {
|
||||
setAlert({ show: true, message: 'Please fill name field.' });
|
||||
return;
|
||||
}
|
||||
@ -88,7 +88,7 @@ const EditDialog = () => {
|
||||
// created_at: formattedTime
|
||||
// });
|
||||
|
||||
doUpdateMunicipios(e);
|
||||
// doUpdateMunicipios(e);
|
||||
console.log(formField);
|
||||
setAlert({ show: false, message: '' });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user