Skip to content

How create an input tag using the input function

macourtney edited this page Sep 13, 2010 · 3 revisions

Added for version: 0.4

If you want to get input from the user in a form, you’ll need to use the input tag which can be created using the input function. However, many of the input tag types are supported in Conjure with other functions such as text-field and hidden-field.

To use the input function, pass the input-type, a record, the name of the record, the name of the key to get the value from, and html-options.

To create a text field and set it’s value to “Blah” use:

(input :text { :text "Blah" } :message :text {})

The above call to input creates a text field with the name “message[text]”, the id “message-text” and the value “Blah”. The html-options map is empty.

To set the input to read only use:

(input :text { :text "Blah" } :message :text { :readonly "readonly" })

Other Input Functions

The following functions create input tags, but are more readable:

  • text-field
  • hidden-field
  • check-box
  • radio-button
  • form-button
Clone this wiki locally