You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can retrieve the value of any input field using `getText(id)` or by using the controller:
127
+
128
+
```dart
129
+
String name = greatForm.getText('name');
130
+
```
131
+
132
+
### 5. Disposing of Form Resources
133
+
Dispose of the form when not in use:
134
+
135
+
```dart
136
+
greatForm.dispose();
137
+
```
138
+
139
+
## Custom Validators
140
+
In addition to built-in validators like `notEmpty`, `minLength`, `validEmail`, and `validCPF`, you can create custom validation functions within the rules for each `FancyInput`. Simply define a function that checks a condition and returns an error message if validation fails.
141
+
142
+
### Example:
143
+
Custom validation to ensure the input contains at least two words:
144
+
145
+
```dart
146
+
FancyInput(
147
+
id: 'name',
148
+
rules: (value) => [
149
+
FancyValidator.notEmpty(value),
150
+
() {
151
+
if (value.trim().split(' ').length < 2) {
152
+
return 'Please enter your full name.';
153
+
}
154
+
return null;
155
+
},
156
+
],
157
+
)
158
+
```
159
+
160
+
## Contributions
161
+
162
+
Contributions are welcome! If you want to contribute to this project, please follow these steps:
163
+
164
+
1. **Fork this repository.**
165
+
2. **Create a new branch for your modification.**
166
+
3. **Make your changes and submit a pull request.**
167
+
168
+
## License
169
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
0 commit comments