Comments (5)
Hi.
Check the updated example
4b03e55
from reactive_forms_generator.
There is no ability to access parent
in current implementation.
you can refer to statically generated control names in your validators
https://github.com/artflutter/reactive_forms_generator/blob/master/packages/reactive_forms_generator/example/lib/docs/login/login.gform.dart#L180
from reactive_forms_generator.
@vasilich6107 Is there a way to obtain the generated form object from a form control? That would allow operating on the controls safely. Otherwise, you kinda lose the benefits of code generation (control names, casting types, finding nested controls).
from reactive_forms_generator.
hi. The thing is that
'Prefer not to call `model` on non-valid form it could cause unexpected exceptions
in case you created a non-nullable field
in model and expect it to be guarded by some kind of `required` validator.',
Let's say you have String
(non nullable field) in your model, it is guarded by required
validator.
at the time you are calling mustMatch
the counterpart field could be null
and it will have an exception due to the casting of String?
to String
from reactive_forms_generator.
Thanks @vasilich6107 I see what's the concern. I think I'm not talking about reading form model values from a control but, rather than that, accessing other field controls in a typesafe way. So instead of doing:
FormControl<Field2ValueType> getField2Control(FormControl field1Control) {
final formGroup = field1Control.parent as FormGroup;
final field2Control = formGroup.control('field2ControlName');
return field2Control as FormControl<Field2ValueType>;
}
There would be something like:
FormControl<Field2ValueType> getField2Control(FormControl field1Control) {
return field1Control.parent.field2Control;
}
I guess that's a completely new feature (assuming it would be possible) and not a trivial change.
from reactive_forms_generator.
Related Issues (20)
- didUpdateWidget sets the form to pristine and untouched HOT 5
- How to properly dispose Form, dynamic fields/formgroup all at once? HOT 1
- How to use with freezed unions? HOT 3
- How to create a group that can be also a form in some situations. HOT 2
- There is a form.model getter? HOT 1
- [BUG] {Model}Form is generated for each file that use it as a import. HOT 6
- Unexpected warning message for nested form models HOT 6
- test HOT 4
- form.model is wrong when use a nested array of groups HOT 7
- [Feature Request] add submit method to FormModel HOT 3
- reactive_forms_annotations not updated to 1.2.0 HOT 4
- Could not format because the source could not be parsed HOT 2
- MinValidator() don't work HOT 2
- Data are not binding HOT 24
- Example of a ReactiveFormsGenerator on ViewModel HOT 4
- The casing of key names of Form value is different from what Freezed package generated HOT 7
- The static formControlNames could be const HOT 2
- Validators set programmatically get cleared on didUpdateWidget HOT 1
- Programmatically Add controls HOT 2
- @FormArrayAnnotation() with inheritance HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactive_forms_generator.