Open FransdeJong opened 3 years ago
I'm currently using Material Design Web so I need to manually control some of the classes of my inputs. I added two callback functions to be fired every time an input is marked as valid or invalid (it could be only one callback too).
addedErrorToInput: (input: HTMLInputElement, message: string) => void;
removedErrorFromInput: (input: HTMLInputElement) => void;
Then you call it at the end of addError(input: HTMLInputElement, message: string)
:
this.addedErrorToInput(input, message);
And removeError(input: HTMLInputElement)
:
this.removedErrorFromInput(input);
In your JS:
validationService.addedErrorToInput = (input, message) => { // Do whatever you need here };
validationService.removedErrorFromInput = input => { // Do whatever you need here };
I know it's not the perfect way to do it but man it worked very well.
Is there a way to disable the submitbutton (or add a disabled class) on submit and re-enable after validation errors? We've looked through the code but couldn't find a way to implement it.