Fixes validation on Tabs and Cms pages
This commit is contained in:
parent
fccf4907a0
commit
6363205f34
|
|
@ -433,7 +433,9 @@
|
|||
/*
|
||||
* Detect invalid fields, focus the tab
|
||||
*/
|
||||
$(window).on('ajaxInvalidField', function(ev, element, name){
|
||||
$(window).on('ajaxInvalidField', function(event, element, name, messages, isFirst){
|
||||
if (!isFirst) return
|
||||
event.preventDefault()
|
||||
element.closest('[data-control=tab]').ocTab('goToElement', element)
|
||||
element.focus()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@
|
|||
/*
|
||||
* Detect invalid fields, uncollapse the panel
|
||||
*/
|
||||
$(window).on('ajaxInvalidField', function(ev, element, name){
|
||||
$(window).on('ajaxInvalidField', function(ev, element, name, messages, isFirst){
|
||||
if (!isFirst) return
|
||||
event.preventDefault()
|
||||
|
||||
var $panel = element.closest('.form-tabless-fields.collapsed'),
|
||||
$primaryPanel = element.closest('.control-tabs.primary.collapsed')
|
||||
|
|
|
|||
|
|
@ -215,10 +215,7 @@ if (window.jQuery === undefined)
|
|||
$(window).trigger(_event, [fieldElement, fieldName, fieldMessages, isFirstInvalidField])
|
||||
|
||||
if (isFirstInvalidField) {
|
||||
if (!_event.isDefaultPrevented()) {
|
||||
// Bug in Chrome, calling events too early
|
||||
setTimeout(function(){ fieldElement.focus() }, 1)
|
||||
}
|
||||
if (!_event.isDefaultPrevented()) fieldElement.focus()
|
||||
isFirstInvalidField = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue