LT-67: Focusing the first form input on validation error
This commit is contained in:
1 parent
34a16930ef
commit
620f5fd4ff
1 file changed
+10
@@ -35,6 +35,16 @@ OHIF.mixins.form = new OHIF.Mixin({
|
||||
|
||||
// Set the component main and style elements
|
||||
component.$style = component.$element = instance.$('form:first');
|
||||
|
||||
instance.autorun(() => {
|
||||
// Run this computation everytime the validation is triggered
|
||||
component.validationObserver.depend();
|
||||
|
||||
// Focus the first error field if some validation failed
|
||||
if (component.schema && component.schema._invalidKeys.length) {
|
||||
instance.$('.state-error :input:first').focus();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
events: {
|
||||
|
||||
Reference in new issue
Block a user