searchable_dropdown
searchable_dropdown copied to clipboard
Validator Not Working Properly
I wrapped the SearchableDropdown.single
inside a Form Widget which has a global key. I defined the SearchableDropdown's validator as (value)=> value == null ? 'field required' : null
. On button pressed
onPressed: () {
if (_myFormKey.currentState.validate()) {
// Show success message
}
else {
// Show error
}
The validator does not respond correctly and allows me to show success message on null values. Please look into this matter asap!
I wrapped the
SearchableDropdown.single
inside a Form Widget which has a global key. I defined the SearchableDropdown's validator as(value)=> value == null ? 'field required' : null
. On button pressedonPressed: () { if (_myFormKey.currentState.validate()) { // Show success message } else { // Show error }
The validator does not respond correctly and allows me to show success message on null values. Please look into this matter asap!
hi, i'm try to this, maybe can be solved your problem `String selectValidation;
validator: (value) => this.selectValidation,
validation: () { if (selectValidation== null) { setState(() { this.selectValidation= 'Skema is required'; }); } else { setState(() { this.skemaValidation = null; }); }
if (!_formKey.currentState.validate()) {
return "Fill form correctly";
}
return null;
},`