Haven't you ever felt that getting data from a Form, validating a field, or even disabling the submit button is tedious and full of boiler...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for the package. I use angular at work and flutter for my personal projects. I was thinking of making sth like form builder for flutter and found that there was already oneπ₯³π₯³π₯³. Any way I can contribute to the package although I am not a seasoned developer yet?.
Hi Rinzin,
Thank you for your comments. You are welcome to contribute to the package. Your experience is not a problem, together we can improve the package as much as necessary.
Hello may I ask, how can I convert the date and time format after I select date and time?
like 12-hour format (12:01 AM) for time and YYYY-MM-D for date
Lastly, how can I add validation messages to a reactive textfield v7.0.0+
Hi John Lester,
You can add a ControlValueAccessor to the reactive text field with the format.
In the Wiki you have an example of how to do that.
To add a validation message you just supply the validationMessages callback method in ReactiveTextField and return a Map with the messages:
Could you provide a working code example for ReactiveDatePicker?
I am trying but I always get an error "Invalid date format".
My code:
....
var last = DateTime.now ();
var firstDate= DateTime.parse ('2021-01-16');
.....
ReactiveDatePicker (
formControlName: 'birthDate',
firstDate: firstDate,
lastDate: last,
builder: (context, picker, child) {
return IconButton (
onPressed: picker.showPicker,
icon: Icon (Icons.date_range));
}),
Hi @ctechdev ,
I have released new versions of the package (v10.2.0). Have you test it? Have you created an issue in the github repo?
Hi John
Your library is life saver :D
One question I wanted to ask is if I wanted to change the decoration around the text fields, how should I do that? like the color of fields and colors of field names that show up the field when a text field is in focus. I understand it is taking defaults from the theme of app but if I wanted to do specific decoration for the text fields how should it be done.
Hi, I would like to use multiple reactive forms. I created a tabbarview with 6 different tabs and each view has a different reactive form. At the top of the appbar I created a button to save the data of all the forms in an Entry object. How can I implement this function without global keys using a provider that collects the data entered in all the tabs? Thanks in advance.
Hi ctechdev,
A simple way to create a wizard is for example to wrap all the widget within a ReactiveForm and each TabBarView can contains a ReactiveForm to collect specific data.
Hi! Can I ask if it is possible to add a dynamic reactive text field to a form?
Hi Jhon,
Right now there is a method FormGroup.addAll() that receives a collection of FormControls and append them as children. But maybe is not what you're asking for.
So I will add that as an issue in the GitHub repo and I will bring the possibility to add a single control FormGroup.add() and that action will trigger an event of type FormControlCollection.collectionChanges.
I will release it in next version.
Thanks again.
Hi John Lester,
I've just released v6.0.0.
In this version like in the previous one, you can add controls to a group with the method FormGroup.addAll(). This method receives a Map of controls as arguments. In this version the disrty/pristine state of the group is updated and it also triggers the onCollectionChanges event.
Hi may I ask how did you put an initial value coming from firebase?
Hi John,
You can just set the value to a control as soon as you get it or you can reset the control to and initial value (release 4.0.0)
or
One more thing it is possible to untouch a reactiveTextfield upon editing?
For example, I have an async validation that will check if an email is existing then, when I go to the editing profile screen it automatically validates the value of that field which I don't like. I want to validate it when the value of that field changes.
Lastly, is it possible to add an additional parameter to custom validator?
Hello John,
Async validators executes after every Sync validator executes without validation errors. That means that if you add for example Validators.required or Validators.email to your ReactiveTextField only when those validators marks the input as valid then the Async Validator excecutes.
But I think you are right about the issue, I will release soon a new version that let you ask inside your validator if the control is "dirty" or not, so you can check if the value has changed or not and request the server in the async validator. Mean while you can implement a workaround by asking inside your async validator if the value of the FormControl is different from the value of your model.
About the Second question, yes you can create a custom validator with additional params, there are two ways of doing this:
1-) Create a function/method that receives arguments and returns a ValidatorFunction. An example of this is the Validators.mustMatch. You can check the README.md.
2-) Extend Validator class.
Creating a function/method
Usage
Extend Validator class (this is the implementation of Validators.pattern)
Usage
Validators.mustMatch and Validators.pattern are already included in Reactive Forms so you don't have to implement them, the above code are just examples to get the idea.
Thank you so much for your help! I will look forward to the next version of your package! β€
That's great! Thank you so much! π
Hi, Joan Pablo
Hope you are doing well. I have a question regard reactive forms fields. I have an api in the response of api i got different forms information how i can impliment with this using reactive forms fields?
Hi Joan,
May I ask how to dynamically add and remove validator in a specific formControl.
For example,
imgur.com/a/ERz7wGa
Hi John,
In the recently version 10.2.0 you can add validators dynamically.