code: func ValidationFilter(c *Controller, fc []Filter) {
  	// If json request, we shall assume json response is intended,
  	// as such no validation cookies should be tied response
  	if c.Params != nil && c.Params.JSON != nil {
  		c.Validation = &Validation{Request: c.Request, Translator: MessageFunc}
  		fc[0](c, fc[1:])
  	} else {
  		errors, err := restoreValidationErrors(c.Request)
  		c.Validation = &Validation{
  			Errors:     errors,
  			keep:       false,
  			Request:    c.Request,
  			Translator: MessageFunc,
  		}
  		hasCookie := (err != http.ErrNoCookie)
  
  		fc[0](c, fc[1:])
  
  		// Add Validation errors to ViewArgs.
  		c.ViewArgs["errors"] = c.Validation.ErrorMap()
  
  		// Store the Validation errors
  		var errorsValue string
  		if c.Validation.keep {
  			for _, err := range c.Validation.Errors {
  				if err.Message != "" {
  					errorsValue += "\x00" + err.Key + ":" + err.Message + "\x00"
  				}
  			}
  		}
  
  		// When there are errors from Validation and Keep() has been called, store the
  		// values in a cookie. If there previously was a cookie but no errors, remove
  		// the cookie.
  		if errorsValue != "" {
  			c.SetCookie(&http.Cookie{
  				Name:     CookiePrefix + "_ERRORS",
  				Value:    url.QueryEscape(errorsValue),
  				Domain:   CookieDomain,
  				Path:     "/",
  				HttpOnly: true,
  				Secure:   CookieSecure,
  			})
  		} else if hasCookie {
  			c.SetCookie(&http.Cookie{
  				Name:     CookiePrefix + "_ERRORS",
  				MaxAge:   -1,
  				Domain:   CookieDomain,
  				Path:     "/",
  				HttpOnly: true,
  				Secure:   CookieSecure,
  			})
  		}
  	}
  }
docs: // ValidationFilter revel Filter function to be hooked into the filter chain.