check if form is completely filled

This commit is contained in:
2024-08-16 10:40:22 +02:00
parent 0aed0f2905
commit 824bb75f0d
2 changed files with 54 additions and 3 deletions

View File

@@ -147,8 +147,34 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
);
}
bool isFieldsFilled() {
if (nameController.text.isEmpty ||
typeController.text.isEmpty ||
regController.text.isEmpty ||
logonameController.text.isEmpty ||
fnameController.text.isEmpty ||
lnameController.text.isEmpty ||
titleController.text.isEmpty ||
signtureController.text.isEmpty ||
accessController.text.isEmpty ||
contactController.text.isEmpty) {
return false;
} else {
return true;
}
}
void submitForm() {
createBusinessProfileAPICall();
if (isFieldsFilled()) {
createBusinessProfileAPICall();
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
);
}
}
@override

View File

@@ -215,9 +215,34 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
);
}
bool isFieldsFilled() {
if (nameController.text.isEmpty ||
typeController.text.isEmpty ||
regController.text.isEmpty ||
logonameController.text.isEmpty ||
fnameController.text.isEmpty ||
lnameController.text.isEmpty ||
titleController.text.isEmpty ||
signtureController.text.isEmpty ||
accessController.text.isEmpty ||
contactController.text.isEmpty) {
return false;
} else {
return true;
}
}
void submitForm(String business_id) {
//to-do late
updateBusinessProfileAPICall(business_id);
if (isFieldsFilled()) {
updateBusinessProfileAPICall(business_id);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
);
}
}
@override