title: Conditional validation for a form inputs
body: <p>Starting off there is a append button that generates a row with 1 select box, 1 inputbox, and 4 checkboxes. The limit of adding this would be 1-10 rows at max. I have no idea how to make a jquery validation using for example <a href="http://formvalidation.io/" rel="nofollow">http://formvalidation.io/</a> - or a standalone jquery code. The rules I would like to apply:</p>
  
  <p>If the role chosen is user (not an admin) , I must validate that there is at least one checkbox checked and the user doesn't appears twice in the selections</p>
  
  <p>The thing is I don't even know where to start from, can you point me any hints?</p>
  
  <p><strong>Live example ::</strong> <a href="http://jsfiddle.net/Yy2gB/131/" rel="nofollow">http://jsfiddle.net/Yy2gB/131/</a></p>
  
  <p>Append method onClick</p>
  
  <pre><code>$(document).ready(function(){
      var obj = {"1":"Admin istrator","2":"User2"};
  
      //$('.selectpicker').selectpicker();
      $(".addCF").click(function(){
  
          count = $('#customFields tr').length + 1;
          var sel = $('&lt;select name="user'+count+'"&gt;');
  
          for(key in obj){
              // The key is key
              // The value is obj[key]
              sel.append($("&lt;option&gt;").attr('value',key).text(obj[key]));
          }
  
          $('.selectpicker').selectpicker();
          $("#customFields").append('&lt;tr&gt;&lt;td&gt;'+sel[0].outerHTML
          +'&lt;/td&gt;&lt;td&gt;&lt;input class="form-control" class="valid_role"'
          +' data-fv-field="emails" type="text" name="role'+count
          +'" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox"'
          +' name="can_edit'+count+'"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" '
          +'class="mycheckbox" name="can_read'+count+'"&gt;&lt;/td&gt;&lt;td&gt;&lt;input '
          +'type="checkbox" class="mycheckbox" name="can_execute'+count+'"&gt;'
          +'&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox" '
          +'name="is_admin'+count+'"&gt;&lt;/td&gt;&lt;td&gt;&lt;a href="javascript:void(0);"'
          +'class="remCF"&gt;Remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;');
          $('.mycheckbox').iCheck({
              checkboxClass: 'icheckbox_square-blue',
              radioClass: 'iradio_square-blue'
          });
          $('.selectpicker').selectpicker();
      });
      $("#customFields").on('click','.remCF',function(){
      $(this).parent().parent().remove();
      });
  });
  </code></pre>
  
  <p>HTML Form</p>
  
  <pre><code>&lt;div class="col-md-12 col-lg-12"&gt; 
    &lt;table class="table table-user-information" id="customFields"&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th class="standardTable_Header"&gt;User&lt;/th&gt;
          &lt;th class="standardTable_Header"&gt;Role&lt;/th&gt;
          &lt;th class="standardTable_Header"&gt;
            &lt;span title="administrator projektu"&gt;Can read&lt;/span&gt;
          &lt;/th&gt;
          &lt;th class="standardTable_Header"&gt;
             &lt;span title="uprawnienie do edycji danych projektu"&gt;
               edit
             &lt;/span&gt;
          &lt;/th&gt;
          &lt;th class="standardTable_Header"&gt;
            &lt;span title="uprawnienie do odczytu danych projektu oraz przypisanych do niego zadań"&gt;
             excute
            &lt;/span&gt;
          &lt;/th&gt;
          &lt;th class="standardTable_Header"&gt;
            &lt;span title="uprawnienie do edycji danych projektu"&gt;
              admin
            &lt;/span&gt;
           &lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;button type="button" class="btn btn-default addCF"&gt;
        Append
      &lt;/button&gt;
      &lt;/div&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>