hiccup.form

Functions for generating HTML forms and input fields.

check-box

(check-box attr-map? name)(check-box attr-map? name checked?)(check-box attr-map? name checked? value)

Creates a check box.

drop-down

(drop-down attr-map? name options)(drop-down attr-map? name options selected)

Creates a drop-down box using the <select> tag.

email-field

(email-field attr-map? name)(email-field attr-map? name value)

Creates a new email input field.

file-upload

(file-upload attr-map? name)

Creates a file upload input.

form-to

(form-to attr-map? [method action] & body)

Create a form that points to a particular method and route. For example:

(form-to [:put "/post"]
  ...)

hidden-field

(hidden-field attr-map? name)(hidden-field attr-map? name value)

Creates a hidden input field.

label

(label attr-map? name text)

Creates a label for an input field with the supplied name.

password-field

(password-field attr-map? name)(password-field attr-map? name value)

Creates a new password field.

radio-button

(radio-button attr-map? group)(radio-button attr-map? group checked?)(radio-button attr-map? group checked? value)

Creates a radio button.

reset-button

(reset-button attr-map? text)

Creates a form reset button.

select-options

(select-options attr-map? coll)(select-options attr-map? coll selected)

Creates a seq of option tags from a collection.

submit-button

(submit-button attr-map? text)

Creates a submit button.

text-area

(text-area attr-map? name)(text-area attr-map? name value)

Creates a text area element.

text-field

(text-field attr-map? name)(text-field attr-map? name value)

Creates a new text input field.

with-group

macro

(with-group group & body)

Group together a set of related form fields for use with the Ring nested-params middleware.