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

Form.render

$form.render($submitButtonLabel, $htmlAttributes = {}) -> HtmlString

Description

Render all HTML for the form, including a submit button.

If $submitButtonLabel is an empty string, no submit button will be added.

@@.form = Form.create('contactForm', {
    email: {
        rule: 'email',
    },
    message: {
        rule: 'comment',
    },
}

fn main {

    // The JS is required for it to work in the browser.
    $page = Page.create({
        css: [url'/vendor/basic.css'],
        js: [url'/vendor/form.js'],
    })

    $formHtml = @@.form.render('Contact Us')

    $page.setMain($formHtml)
    $page.send()
}

fn mainPost {
    // process form...
}

See Also

See Also