Clear default value
Hi, I have a FormControl with default value 0 like this
'prodTray': FormControl<int>(
value: 0,
validators: [Validators.number, Validators.pattern(kTrayNumberPattern)],
),
so i want when the user Tap on this field clear the dafault value and empty the field
How can i do this Thank in advance
Thank you i found the solution
onTap:(FormControl<int> control)=>control.value=null,
i will close the issue
Hi @SaddamMohsen
You can also use just
control.reset()
Hi @SaddamMohsen
You can also use just
control.reset()
thank you very much this what i want
Thank you @joanpablo i have another question how can i using reactive form with stepper widget
Hi @SaddamMohsen,
Any situation is different. Here are two common patterns:
1- Having just one FormGroup and binding widgets of each step to the controls in the group.
- This is for simple scenarios, you basically split a simple form into several views.
- Each step almost always has one up to three reactive widgets controls.
- You validate the Form at the end but you can always restrict when to jump into the next step based on the validity of an individual control of the active view.
1- Having a parent FormGroup with several nested FormGroup.
- This is for more complex Forms.
- You will have a FormGroup for each step. Usually in each step, you have more than three widgets, and complex business validations.
- Even though you validate the entire flow (all the steps) at the end with the parent
FormGroup, you have more strict control and validation on each step.
I hope this can help you understand when to use what variation.