Sha256: 829b05e2fd0f3ebe994080db37b994a9b8a31814906b2d361ed7d1e40c58e485
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
$.extend(window.Parsley.options, { focus: "first", excluded: "input[type=button], input[type=submit], input[type=reset], .search, .ignore", triggerAfterFailure: "change blur", errorsContainer: function (element) {}, trigger: "change", successClass: "is-valid", errorClass: "is-invalid", classHandler: function (el) { return el.$element.closest(".form-group") }, errorsContainer: function (el) { return el.$element.closest(".form-group") }, errorsWrapper: '<div class="parsley-error"></div>', errorTemplate: "<span></span>", }) Parsley.on("field:validated", function (el) { var elNode = $(el)[0] if (elNode && !elNode.isValid()) { var rqeuiredValResult = elNode.validationResult.filter(function (vr) { return vr.assert.name === "required" }) if (rqeuiredValResult.length > 0) { var fieldNode = $(elNode.element) var formGroupNode = fieldNode.closest(".form-group") var lblNode = formGroupNode.find(".form-label:first") if (lblNode.length > 0) { // change default error message to include field label var errorNode = formGroupNode.find( "div.parsley-error span[class*=parsley-]" ) if (errorNode.length > 0) { var lblText = lblNode.text() if (lblText) { errorNode.html(lblText + " is required.") } } } } } }) Parsley.addValidator("restrictedCity", { requirementType: "string", validateString: function (value, requirement) { value = (value || "").trim() return value === "" || value.toLowerCase() === requirement.toLowerCase() }, messages: { en: 'You have to live in <a href="https://www.google.com/maps/place/Jakarta">Jakarta</a>.', }, })
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mazer-rails-0.1.4 | vendor/assets/javascripts/pages/parsley.js |
mazer-rails-0.1.3 | vendor/assets/javascripts/pages/parsley.js |
mazer-rails-0.1.2 | assets/javascripts/pages/parsley.js |