Wednesday, 12 March 2008

grails-jttaglib-0.1

grails-jttaglib plugin is a small collection of convenience tags.

The sample code below assumes you have a domain class that looks like this:
 class Book {
String title="my new book"
String content

static def constraints = {
title(maxSize:20)
content(maxSize:200)
}
}

When using these tags, you must have the following in the page - normally in the head block:
<g:javascript library="prototype"/>

<jttext:script />

textArea

Creates a TextArea HTML element, where the maximum number of characters is
limited by the constraints on the domain object, and tabs can be allowed if
desired.

Sample use:
<jttext:textArea object="${new Book()}" name="content" allowTabs="true"/>

<jttext:statusDiv for="content" />

The number of remaining characters available are displayed in the status div.
If allowTabs is set to true, tabs can be entered in the text area.

textField

Creates a text input type using maxlength from the objects constraints.
Sample use:
<jttext:textField object="${book}" name="title"/>

Generates:
<input type="text" name="title" maxlength="20" value="my new book" id="title" />

Download grails-jttaglib-0.1.zip

0 comments:

Post a Comment