Closed mefesto closed 12 years ago
I'd like to request that the action parameter of hiccup.form/form-to be optional -- if omitted then no action attribute is needed in the HTML markup which will default the form to submit to the current url.
action
hiccup.form/form-to
Below is an example of my use case:
(ns myapp.routes (:require [myapp.views :as form])) (defroutes app-routes (GET "/myform" [] form/show) (POST "/myform" [] form/update))
(ns myapp.views) (defn show [request] (layout/standard [:h1 "My Test Form"] (form/form-to [:post ""] (form/label :name "Name") (form/text-field :name) (form/submit-button "Submit")))) (defn update [request] (do-stuff) (redirect "/"))
I do this frequently and just thought it would be a sensible default.
So you're saying:
(form-to [:post] ...)
Should be the same as:
(form-to [:post ""] ...)
?
Yep :-)
On reflection, I think it's better to keep the action as explicit, even when it's just a blank string.
I'd like to request that the
action
parameter ofhiccup.form/form-to
be optional -- if omitted then no action attribute is needed in the HTML markup which will default the form to submit to the current url.Below is an example of my use case:
I do this frequently and just thought it would be a sensible default.