We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formBuilderKey.currentState.value wont change, it always returns the provided initial value.
formBuilderKey.currentState.value
i'm passing formBuilderKey on parent widget to child widget. on child widget, it uses like widget.formBuilderKey. is it not a valid usecase?
formBuilderKey
widget.formBuilderKey
parent.dart
Widget build(BuildContext context){ .... CustomerEditBasicInfoCard( initialValue: data.toCustomerProfileBasicInformationSegment(), onChange: (c) {}, formBuilderKey: formBuilderKey, ), .... } void submitForm() { print("submitting form"); final valid = formBuilderKey.currentState.validate(); if (valid) { data.profile.lastName = formBuilderKey.currentState.value[CustomerFormKeys.lastName]; data.profile.firstName = formBuilderKey.currentState.value[CustomerFormKeys.firstName]; data.profile.phone = formBuilderKey.currentState.value[CustomerFormKeys.phone]; data.type = formBuilderKey.currentState.value[CustomerFormKeys.type]; data.profile.industry = formBuilderKey.currentState.value[CustomerFormKeys.lastName]; print(formBuilderKey.currentState.value); } }
child.dart (CustomerEditBasicInfoCard)
Widget _buildBody() { return FormBuilder( key: widget.formBuilderKey, initialValue: { CustomerFormKeys.birth: widget.initialValue.birth ?? DateTime.now(), CustomerFormKeys.firstName: widget.initialValue.firstName, CustomerFormKeys.lastName: widget.initialValue.lastName, CustomerFormKeys.phone: widget.initialValue.phoneNumber, CustomerFormKeys.type: widget.initialValue.type }, autovalidate: true, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ _buildTemplateSelection(), FormBuilderTextField( attribute: CustomerFormKeys.firstName, decoration: InputDecoration(hintText: "first name"), maxLines: 1, validators: [ FormBuilderValidators.required(), FormBuilderValidators.maxLength(20), ], ), FormBuilderTextField( attribute: CustomerFormKeys.lastName, decoration: InputDecoration(hintText: "last name"), maxLines: 1, validators: [ FormBuilderValidators.maxLength(20), ], ), FormBuilderTextField( attribute: CustomerFormKeys.phone, decoration: InputDecoration(hintText: "phone number"), validators: [ FormBuilderValidators.maxLength(30), FormBuilderValidators.numeric(), ], ), FormBuilderDateTimePicker( attribute: CustomerFormKeys.birth, inputType: InputType.date, format: DateFormat("yyyy-MM-dd"), decoration: InputDecoration(labelText: "birthday"), ), ], )); }
The text was updated successfully, but these errors were encountered:
changing _fbKey.currentState.validate() to _fbKey.currentState.saveAndValidate() worked
_fbKey.currentState.validate()
_fbKey.currentState.saveAndValidate()
Sorry, something went wrong.
No branches or pull requests
formBuilderKey.currentState.value
wont change, it always returns the provided initial value.i'm passing
formBuilderKey
on parent widget to child widget. on child widget, it uses likewidget.formBuilderKey
. is it not a valid usecase?parent.dart
child.dart (CustomerEditBasicInfoCard)
The text was updated successfully, but these errors were encountered: