public void Apply(IHtmlRuleDef def, ElementRequest request, HtmlTag tag) { var rule = def.RuleInstance.As<MaximumLengthRule>(); var template = ValidationKeys.MAX_LENGTH.ToString(); var message = TemplateParser.Parse(template, new Dictionary<string, string> {{MaximumLengthRule.LENGTH, rule.Length.ToString()}}); // NOTE: LET'S IGNORE THIS JUST FOR DEMO SAKE // tag.Attr("maxlength", rule.Length); tag.Rules("rangelength", new[] {0, rule.Length}); tag.Messages("rangelength", message); }
public void Apply(IHtmlRuleDef def, ElementRequest request, HtmlTag tag) { tag.Rules("required"); tag.Messages("required", ValidationKeys.REQUIRED.ToString()); }
public void Apply(IHtmlRuleDef def, ElementRequest request, HtmlTag tag) { tag.Rules("min", 0); tag.Messages("min", ValidationKeys.GREATER_OR_EQUAL_TO_ZERO.ToString()); }