Monday, April 13, 2009

Groovlet quick tip: textarea()

Using textarea with Markup Builder in a Groovlet can be tricky.

My initial attempt was:
div()
{
	textarea(name: "content", rows: "3", cols: "60")
}

This however results in invalid html:
<div>
    <textarea name='content' rows='3' cols='60' />
</div>


The correct way is to include an empty string (content of the textarea) in the constructor:
div()
{
	textarea(name: "content", rows: "3", cols: "60", "")
}

Which yields correct html:
<div>
    <textarea name='content' rows='3' cols='60'></textarea>
</div>

I hope this helps, since Groovlet documentation is quite sparse.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...