/** * * {@inheritDoc} */ public void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field) { super.renderContribution(writer, cycle, context, field); String message = buildMessage(context, field, getMessageKey()); JSONObject profile = context.getProfile(); if (!profile.has(ValidationConstants.CONSTRAINTS)) { profile.put(ValidationConstants.CONSTRAINTS, new JSONObject()); } JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS); context.addInitializationScript(field, "dojo.require(\"tapestry.form.datetime\");"); accumulateProperty(cons, field.getClientId(), new JSONLiteral("[tapestry.form.datetime.isValidDate,{" + "datePattern:" + JSONObject.quote(getPattern()) + (isLenient() ? "" : ",strict:true") + "}]")); accumulateProfileProperty(field, profile, ValidationConstants.CONSTRAINTS, message); }
/** * * {@inheritDoc} */ public void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field) { super.renderContribution(writer, cycle, context, field); String message = buildMessage(context, field, getMessageKey()); JSONObject profile = context.getProfile(); if (!profile.has(ValidationConstants.CONSTRAINTS)) { profile.put(ValidationConstants.CONSTRAINTS, new JSONObject()); } JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS); context.addInitializationScript(field, "dojo.require(\"tapestry.form.datetime\");"); accumulateProperty(cons, field.getClientId(), new JSONLiteral("[tapestry.form.datetime.isValidDate,{" + "datePattern:" + JSONObject.quote(getPattern()) + (isLenient() ? "" : ",strict:true") + "}]")); accumulateProfileProperty(field, profile, ValidationConstants.CONSTRAINTS, message); }
+ "datePattern:" + JSONObject.quote(translator.getPattern()) + (translator.isLenient() ? "" : ",strict:true") + "}]"));
+ "datePattern:" + JSONObject.quote(translator.getPattern()) + (translator.isLenient() ? "" : ",strict:true") + "}]"));
+ "datePattern:" + JSONObject.quote(translator.getPattern()) + (translator.isLenient() ? "" : ",strict:true") + "}]"));
+ "datePattern:" + JSONObject.quote(translator.getPattern()) + (translator.isLenient() ? "" : ",strict:true") + "}]"));