title: Dojo Programmatically validate TextBox
body: <p>I'm trying to create a dojo form programmatically and validate input TextBox on button click. But when I try to valid I get an error "dijit.byId(..) is undefined. Below is the code:</p>
  
  <pre><code>var form = new dijit.form.Form({ 
                                      nametb: new dijit.form.TextBox({
                                          name: "name",
                                          type: "text",
                                          required: true,
                                          placeHolder: "Your Full Name"
                                      },"nametb"),
                                      subBtn: new dijit.form.Button({
                                          label: "Proceed",
                                          onClick: function(){
                                              if(dijit.byId("nametb").get('value') == null || dijit.byId("nametb").get('value').length == 0 )
                                                  {
                                                      alert("Please enter Name");
                                                      return false;
                                                  }
  
                                          }
                                      }),
                                      cnclBtn: new dijit.form.Button({
                                          label: "Cancel",
                                          onClick: function(){
                                              dia.hide();
                                          }
                                      }),
                                      postCreate: function(){
                                          this.domNode.appendChild(this.nametb.domNode);
                                          this.domNode.appendChild(this.subBtn.domNode);
                                          this.domNode.appendChild(this.cnclBtn.domNode);
                                      }
                                  });
  </code></pre>
  
  <p>But now when I click the Proceed button I get an error <code>dijit.byId(...) is undefined</code></p>
  
  <p>How can I validate this TextBox?</p>