Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2 final
-
Component/s: Controllers
-
Labels:None
-
Environment:Ubuntu Karmic, Grails 1.2.0
Description
Trigger the following urls in the example:
/<app-name>/test/searchForm results in form being properly rendered without errors
/<app-name>/test/search results in form being rendered with errors though the command object passed via the model is not validated,
so I would expect an empty form being rendered just as in the first case
It seems that errors are always rendered if there is a command object parameter being declared in the closure independently of the actual object that is passed to the view. Complete code is given in attachment.
class TestController {
def searchForm =
{ render(view: 'search', model:['cmd': new SearchCommand()]) // properly renders form without error messages, expected behavior }def search =
{SearchCommand c -> if(!params.search) return ['cmd': new SearchCommand()] // renders form with error messages, unexpected behavior ... }}
class SearchCommand {
String zip
static constraints =
}
Workaround: Separate method to render empty form.
Issue Links
- is duplicated by
-
GRAILS-5870
Make Command Object error decoration to be more like Domains
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Fixed: http://github.com/grails/grails/commit/c2f32d99261dd85bcd7597d89c444e665af0414e