Trying to display error-msgs in a Bootstrap-Popup, I found a solution from TheDude and have adjusted the event-names for ps2.1:
$.listen('field:error', function (fieldInstance) {
arrErrorMsg = ParsleyUI.getErrorsMessages(fieldInstance);
errorMsg = arrErrorMsg.join(';');
fieldInstance.$element
.popover('destroy')
.popover({
container: 'body',
placement: 'right',
content: errorMsg
})
.popover('show');
});
$.listen('field:success', function (fieldInstance) {
fieldInstance.$element.popover('destroy');
});
This works wonderfully, but I'm getting a msg in the JS-Console: "Parsley's pubsub module is deprecated; use the corresponding jQuery event method instead". There are very few hits for that msg in Google, and I'm afraid I'm not (yet) sufficiently versed with Parsley to understand and fix this problem - would appreciate some help to make my code future-proof :-)
Sorry, I just was too impatient and started looking and it was easier than expected: the
$.listen
needs to be changed intowindow.Parsley.on
. That's it! :-)