-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
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
wip: add form controller #15
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 4660014813
💛 - Coveralls |
we should add:
|
still perfecting this but now we're getting somewhere:
to figure out: basically the form validators don't work right now. they get passed the entire object but before any changes from the user input happened (making them useless). validators are meant to prevent input from updating the value if they return falsely. so either we throw away 'form validators' and stick with just field validators, or we create a deep clone of the value just to give these validators (so they can still prevent changes). not sure yet... |
ok new update:
so updated usage: ctrl.addValidator((values) => {
// values here is `ctrl.value`
// this will be called on submission and decide if the form should submit or not
});
ctrl.addValidator(('email', (value) => {
// value here is the email from `ctrll.value.email`
// returning a string here will imply the field is invalid and will add the string to `ctrl.errors`
// returning void or null will imply the field is valid
}); |
playing around with introducing a form controller.
with this kind of usage:
you can also use validators:
draft until it becomes less of an endless what if?