vendor/assets/javascripts/webshims/shims/combos/30.js in webshims-rails-1.12.7 vs vendor/assets/javascripts/webshims/shims/combos/30.js in webshims-rails-1.13.0

- old
+ new

@@ -1397,10 +1397,11 @@ } }; webshims.getContentValidationMessage = function(elem, validity, key){ + var customRule; if(webshims.errorbox && webshims.errorbox.initIvalContentMessage){ webshims.errorbox.initIvalContentMessage(elem); } var message = (webshims.getOptions && webshims.errorbox ? webshims.getOptions(elem, 'errormessage', false, true) : $(elem).data('errormessage')) || elem.getAttribute('x-moz-errormessage') || ''; if(key && message[key]){ @@ -1411,11 +1412,13 @@ message = ''; } } if(typeof message == 'object'){ validity = validity || $.prop(elem, 'validity') || {valid: 1}; - if(!validity.valid){ + if(validity.customError && (customRule = $.data(elem, 'customMismatchedRule')) && message[customRule] && typeof message[customRule] == 'string'){ + message = message[customRule]; + } else if(!validity.valid){ $.each(validity, function(name, prop){ if(prop && name != 'valid' && message[name]){ message = message[name]; return false; } @@ -1713,10 +1716,12 @@ if(!message && name == 'typeMismatch'){ message = getMessageFromObj(currentValidationMessage.badInput, elem); } if(!message){ message = getMessageFromObj(validityMessages[''][name], elem) || $.prop(elem, 'validationMessage'); - webshims.info('could not find errormessage for: '+ name +' / '+ $.prop(elem, 'type') +'. in language: '+webshims.activeLang()); + if(name != 'customError'){ + webshims.info('could not find errormessage for: '+ name +' / '+ $.prop(elem, 'type') +'. in language: '+webshims.activeLang()); + } } message = webshims.replaceValidationplaceholder(elem, message, name); return message || ''; };