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

Form.toHtml

$form.toHtml($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'
    }
}

fun 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.toHtml('Contact Us')
    $page.setMain($formHtml)

    Output.sendPage($page)
}

fun mainPost {
    // process form...
}

See Also

See Also