title: How validate form data read using JSON?
body: <p>I am workign creating a form wizard based on JSON data. I have created a form based on JSON feed and I got this working fine, next is how can i incorporate jquery validation.js into my code.</p>
  
  <p>I am using jquery.dfrom to generate a form based on JSON example here
  <a href="https://github.com/daffl/jquery.dform" rel="nofollow">https://github.com/daffl/jquery.dform</a></p>
  
  <p>Next, I want to  validate the form generated for user input(s) before it gets submitted.</p>
  
  <p>How can i validate this generated html form?
  Thanks</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSOn based form wizard jQuery dForm&lt;/title&gt;
      &lt;/head&gt;
      &lt;style type="text/css"&gt;
          input, label {
              display: block;
              margin-bottom: 5px;
          }
      &lt;/style&gt;
      &lt;body&gt;
  
  
      &lt;form id="demo-2-form"&gt;&lt;/form&gt;
  
  
      &lt;!-- Load jQuery and the minified plugin --&gt;
      &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="dist/jquery.validate.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="dist/jquery.dform-1.0.1.js"&gt;&lt;/script&gt;
  
  
      &lt;script type="text/javascript" class="demo" id="demo-2"&gt;
      $('#demo-2-form').dform({
          "action":"index.html",
          "method":"post",
          "html":[
              {
                  "type":"fieldset",
                  "caption":"User information",
                  "html":[
                      {
                          "name":"email",
                          "caption":"Email address",
                          "type":"text",
                          "placeholder":"E.g. user@example.com",
                          "validate":{
                              "email":true
                          }
                      },
                      {
                          "name":"password",
                          "caption":"Password",
                          "type":"password",
                          "id":"registration-password",
                          "validate":{
                              "required":true,
                              "minlength":5,
                              "messages":{
                                  "required":"Please enter a password",
                                  "minlength":"At least {0} characters long"
                              }
                          }
                      },
                      {
                          "name":"password-repeat",
                          "caption":"Repeat password",
                          "type":"password",
                          "validate":{
                              "equalTo":"#registration-password",
                              "messages":{
                                  "equalTo":"Please repeat your password"
                              }
                          }
                      },
                      {
                          "type":"radiobuttons",
                          "caption":"Sex",
                          "name":"sex",
                          "class":"labellist",
                          "options":{
                              "f":"Female",
                              "m":"Male"
                          }
                      },
                      {
                          "type":"checkboxes",
                          "name":"test",
                          "caption":"Receive newsletter about",
                          "class":"labellist",
                          "options":{
                              "updates":"Product updates",
                              "errors":{
                                  "value":"security",
                                  "caption":"Security warnings",
                                  "checked":"checked"
                              }
                          }
                      }
                  ]
              },
              {
                  "type":"fieldset",
                  "caption":"Address information",
                  "html":[
                      {
                          "name":"name",
                          "caption":"Your name",
                          "type":"text",
                          "placeholder":"E.g. John Doe"
                      },
                      {
                          "name":"address",
                          "caption":"Address",
                          "type":"text",
                          "validate":{ "required":true }
                      },
                      {
                          "name":"zip",
                          "caption":"ZIP code",
                          "type":"text",
                          "size":5,
                          "validate":{ "required":true }
                      },
                      {
                          "name":"city",
                          "caption":"City",
                          "type":"text",
                          "validate":{ "required":true }
                      },
                      {
                          "type":"select",
                          "name":"continent",
                          "caption":"Choose a continent",
                          "options":{
                              "america":"America",
                              "europe":{
                                  "selected":"true",
                                  "id":"europe-option",
                                  "value":"europe",
                                  "html":"Europe"
                              },
                              "asia":"Asia",
                              "africa":"Africa",
                              "australia":"Australia"
                          }
                      }
                  ]
              },
              {
                  "type":"submit",
                  "value":"Signup"
              }
          ]
      });
      &lt;/script&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>