Does anybody using 5.4 understand this issue? I'm still unable to get the clientside validation js working.
On Fri, Oct 10, 2014 at 1:59 PM, George Christman <gchrist...@cardaddy.com> wrote: > I found one mistake where I wasn't calling the js directly from render, > but that still doesn't seem to resolve the issue. > > @Override > public void render(Field field, Integer constraintValue, > MessageFormatter formatter, MarkupWriter writer, > FormSupport formSupport) { > > if (formSupport.isClientValidationEnabled()) { > javaScriptSupport.require("custom-validation"); > writer.attributes(DataConstants.VALIDATION_ATTRIBUTE, true, > "data-validate-quarter-hour", > constraintValue.toString(), > "data-quarter-hour-message", buildMessage(formatter, > field, constraintValue)); > } > } > > (function() { > define(["underscore", "./dom", "./events", "./utils", "./messages", > "./fields"], function(_, dom, events) { > > dom.onDocument(events.field.validate, > "[data-validate-quarter-hour]", function(event, memo) { > alert('here'); > var max; > max = parseInt(this.attr("data-validate-quarter-hour")); > if (memo.translated % max === 0) { > memo.error = (this.attr("data-quarter-hour-message")); > return false; > } > }); > }); > > }).call(this); > > On Fri, Oct 10, 2014 at 1:35 PM, George Christman <gchrist...@cardaddy.com > > wrote: > >> Hi guys, I have some custom js to handle some clientside validation in >> 5.4. I can't seem to get it to fire, could someone tell me what I'm doing >> wrong? >> >> custom-validation.js >> >> (function() { >> define(["underscore", "./dom", "./events", "./utils", "./messages", >> "./fields"], function(_, dom, events) { >> >> dom.onDocument(events.field.validate, >> "[data-validate-quarter-hour]", function(event, memo) { >> var max; >> max = parseInt(this.attr("data-validate-quarter-hour")); >> if (memo.translated % max === 0) { >> memo.error = (this.attr("data-quarter-hour-message")); >> return false; >> } >> }); >> }); >> >> }).call(this); >> >> >> @Import( module = {"custom-validation"}) >> >> >> @Override >> public void render(Field field, Integer constraintValue, >> MessageFormatter formatter, MarkupWriter writer, >> FormSupport formSupport) { >> System.out.println("is validation enabled " + >> formSupport.isClientValidationEnabled()); >> if (formSupport.isClientValidationEnabled()) { >> javaScriptSupport.require("t5/core/validation"); >> writer.attributes(DataConstants.VALIDATION_ATTRIBUTE, true, >> "data-validate-quarter-hour", >> constraintValue.toString(), >> "data-quarter-hour-message", buildMessage(formatter, >> field, constraintValue)); >> } >> } >> >> -- >> George Christman >> www.CarDaddy.com >> P.O. Box 735 >> Johnstown, New York >> >> > > > -- > George Christman > www.CarDaddy.com > P.O. Box 735 > Johnstown, New York > > -- George Christman www.CarDaddy.com P.O. Box 735 Johnstown, New York