Skip to content

How to add a single button using button to

macourtney edited this page Sep 13, 2010 · 3 revisions

Added for version: 0.4
Updated for version: 0.7

If all you need is a button from a form, but not have anything else in a form, you can use button-to.

To create a button which points back to the same controller and action but with text “Submit” use:

(button-to "Submit")

If you want to point to a different action you can pass a params map:

(button-to "Submit" { :action "show" })

The params map has the same options as form-for. However, :html-options is applied only to the button and not the form tag.

Button-to also accepts a function for text:

(button-to #(conjure.core.server.request/action) { :action "show" })

The above button-to call displays “show” as it’s text.

Clone this wiki locally