form

Purpose

Creates a form that submits to a controller, action, and/or id. Beyond what is below all the usual HTML attributes apply.

Examples

Example controller for an application called "shop":

class Book {
     def list = { [ books: Book.list( params ) ] }
     def show = { [ book : Book.get( params['id'] ) ] }
}

Example usages for above controller:

<g:form name="myForm" action="myaction" id="1">...</g:form>
results in:
<form action="/shop/book/myaction/1" method="post" name="myForm" id="myForm" >...</form>

<g:form name="myForm" url="[action:'list',controller:'book']">...</g:form> results in: <form action="/shop/book/list" method="post" name="myForm" id="myForm" >...</form>

<g:form action="show">...</g:form> results in: <form action="/shop/book/show" method="post" >...</form>

Description

Attributes

Source

Show Source