Version: v0.7.0 - Beta.  We welcome contributors & feedback.

Form.tag

$form.tag($fieldName, $htmlAttributes = {}) -> HtmlString

Description

Generate an HTML tag for the given form field, including a label and help text.

@@.form = Form.create('commentForm', {
    comment: {
        rule: 'comment|optional',
    }
})

//-- snip page creation --

tm formHtml {

    --- $form = @@.form

    {{ $form.open() }}

    {{ $form.tag('comment') }}

    {{ $form.submitTag('Add Comment') }}

    {{ $form.close() }}
}

HTML Attributes

Key/value pairs in $htmlAttributes will be added to the HTML tag.

Example:

{{ $form.tag('email', { class: 'blue-text'}) }}

//= <input type="email" name="email" class="blue-text" />

See Also