5 ms·
You could instead write abstractions for generating forms, e.g.: (pbox "login/register" (form (text "username:" :name "user") (pass "pass
by bluefox 9y ago
You could instead write abstractions for generating forms, e.g.:
(pbox "login/register"
(form (text "username:" :name "user")
(pass "password:" :name "pass")
(check "remember me" :name "mem")
(group
(button "Login" :onclick "login(); return false")
(button "Register" :onclick "register(); return false"))
(link "what's my password?" :href "/password")))
- codedokode 9y agoThis gets complicated quickly. For example, what if you need to add a CSS class, a placeholder or some custom attribute to an input field? You'll have to write code for every such case. And you can do the same thing with template engines like Twig with macros. Futhermore, Web frameworks like Symfony already have macros that are necessary to display a form. You don't even have to write them and that is a strong point of Symfony compared to weird self-made Lisp template engine.