LT-67: Focusing the first form input on validation error
This commit is contained in:
parent
34a16930ef
commit
620f5fd4ff
@ -35,6 +35,16 @@ OHIF.mixins.form = new OHIF.Mixin({
|
|||||||
|
|
||||||
// Set the component main and style elements
|
// Set the component main and style elements
|
||||||
component.$style = component.$element = instance.$('form:first');
|
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: {
|
events: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user