title: Grails Duplicate Error Messages
body: <p>I'm new to grails and I have a problem: </p>
  
  <p>I have this snippet of GSP: </p>
  
  <pre><code>&lt;g:form url="[controller:'main',action:'login']"&gt; 
    &lt;label for="name"&gt;Usuario:&lt;/label&gt;&lt;br/&gt; 
    &lt;input type="text" name="name" /&gt;&lt;br/&gt; 
    &lt;label for="pass"&gt;Password:&lt;/label&gt;&lt;br/&gt; 
    &lt;input type="password" name="password"/&gt;&lt;br/&gt; 
    &lt;input type="submit" value="Login"/&gt;&lt;br/&gt; 
    &lt;g:renderErrors bean="${cmd}"/&gt; 
  &lt;/g:form&gt; 
  </code></pre>
  
  <p>The Controller (MainController.groovy) uses a Command Object, here's the code for both: </p>
  
  <pre><code>def login = { LoginCommand cmd -&gt; 
    if(cmd.validate()){ 
    redirect(action:'ok') 
    }else{ 
    render(view:'index',model:[cmd:cmd]) 
    } 
    } 
  
  class LoginCommand { 
  
          String name 
          String password 
  
          static constraints = { 
                  name(blank:false,size:5..10) 
                  password(blank:false,size:5..10) 
          } 
  } 
  </code></pre>
  
  <p>The problem is that when I enter a bad name or pass (blank or outside the range) <strong>it shows me 4 errors, two for the password and two for the username</strong>. They are the same, but duplicated.</p>
  
  <p>I found that creating a method "bool validateCommand(){ name &amp;&amp; password }" and replacing it for command.validate() does not throw duplicates, but I want to use the constraints features of Grails to keep things DRY. </p>
  
  <p>Any idea why this happens? Thanks so much!</p>