On Wednesday, 30 April 2014 at 12:26:06 UTC, Nick Sabalausky
wrote:
Automatic forms generated from a type are nice for
quick-n-dirty stuff, but I find they tend to work against (or
at least be much less useful for) the tweaking and
customization usually needed in public-facing production sites.
Aye, I rarely use my automatic forms on live sites either.... but
they are really nice for backend CRUD stuff or a quick-n-dirty
first-draft.
Sometimes though, I can get away with just modifying an automatic
form and kinda want to make web.d 2.0 better at that.
Instead of defining the form in the server-side code and then
awkwardly trying to make it generate the HTML I want, I just
define the form in HTML. (Or rather, in an HTML template that's
still more-or-less valid HTML, with a few additional
non-standard tags to help with metadata like "how to validate
this field").
Yes, rox rox rox.
This is what my html.d originally was for btw, expanding
non-standard tags. Many of them are obsolete now tho, I use html5
attributes instead. Of course, html.d also includes other cool
stuff like CSS expansion and JS foreach macros too, as we fairly
recently talked about.
Then I use Adam's dom.d (in non-strict mode) to read the HTML
form template (preserving the templating stuff)
I use strict mode for that stuff, keep in mind strict mode is
about well-formedness, not validation. So it accepts custom tags
and attributes easily enough.