Beispiel #1
0
        public static FormTag WithValidationSummary <T>(this FormTag form)
        {
            form.Id(typeof(T).Name);
            var summary = new HtmlTag("div")
                          .AddClasses("alert", "alert-error", "validation-container")
                          .Append(new HtmlTag("p").Text(HelloValidationKeys.Summary))
                          .Append(new HtmlTag("ul").AddClass("validation-summary"))
                          .Style("display", "none");

            form.Append(summary);
            return(form);
        }
        public static FormTag ValidationSummary <T>(this FormTag form)
        {
            form.Id(typeof(T).Name);
            var summary = new HtmlTag("div")
                          .AddClasses("alert", "alert-error", "validation-container")
                          .Append(new HtmlTag("p").Text("There are errors with the information you provided."))
                          .Append(new HtmlTag("ul").AddClass("validation-summary"))
                          .Style("display", "none");

            form.Append(summary);
            return(form);
        }
Beispiel #3
0
        public HtmlTag Build(ElementRequest request)
        {
            var naming = request.Get <ElementNaming>();

            var form = new FormTag().NoClosingTag();

            if (request.Model != null)
            {
                form.Id(naming.Form(request.Model));
            }

            return(form);
        }
Beispiel #4
0
        public HtmlTag Build(ElementRequest request)
        {
            var naming = request.Get <ElementNaming>();

            var formTag = new FormTag();

            if (request.Model != null)
            {
                formTag
                .Id(naming.Form(request.Model))
                .Attr("data-form-summary", naming.FormSummaryId(request.Model));
            }

            return(formTag
                   .NoClosingTag()
                   .Attr("data-controller", "form"));
        }
Beispiel #5
0
        public void form_id_can_be_customized()
        {
            var tag = new FormTag().Id("other-form");

            tag.Id().ShouldBe("other-form");
        }
 public void form_id_can_be_customized()
 {
     var tag = new FormTag().Id("other-form");
     tag.Id().ShouldEqual("other-form");
 }