title: how to show error message for textfield validation based on server response
body: <p>I have a <code>textfield</code> which has to be validated based on the user input.By validate what I mean is, I need to check if the name exists in the database and if it exists display error message accordingly. </p>
  
  <p>How I am doing this is, I have a <code>change listener</code> for the <code>text box</code>, within the listener I have a <code>ajax request</code> which connects to a <code>java action</code> and check if name already exists in db, and sends back a <code>response</code>. On <code>ajax success</code>, I am trying to <code>set error message</code>... But the error message is not being set..</p>
  
  <pre><code>{
                          fieldLabel : 'Company Name:',
                          xtype : 'textfield',
                          required: true,
                          allowBlank : false,
                          name : 'companyName',
                           msgTarget: 'side',
                          listeners : {
                              change : function(th,n,o) {
                              console.log("change-EV");
  /*****ajax request here****/
                              this.markInvalid('N.V..!');
                  //          this.setActiveError('NV..',false);
                              },
                              blur: function(th){
                                  console.log("Blur-ev");
                              }
                          }
                      }
  </code></pre>
  
  <p>Is the approach I am using right? Will I be able to achieve this with ajax request?</p>