# withForm

## Purpose

Used to handle duplicate form submissions.

## Examples

    withForm {
       // good request
    }.invalidToken {
       // bad request
    }

## Description

The `withForm` method requires the use of the `useToken` attribute in a form

    <g:form useToken="true" ...>

Then in your controller code you can use the `withForm` method to handle valid and invalid requests:

    withForm {
       // good request
    }.invalidToken {
       // bad request
    }

See Handling Duplicate Form Submissions for more information.