title: Parsley.js validate parts of form based on selected radio button
body: <p>Probably most easily explained via this fiddle: <a href="http://jsfiddle.net/shanomurphy/dL688o9j/" rel="nofollow">http://jsfiddle.net/shanomurphy/dL688o9j/</a></p>
  
  <p>I want to show/hide parts of a form based on what radio button is selected. When a radio button is checked I show some extra form fields and hide others. I only want Parsley.js to validate the shown fields.</p>
  
  <p>I'm running into problems when the selected radio button is changed and parsley validation has already been run.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Vars
  var drinks_fields = $('#drinks');
  var food_fields   = $('#food');
      
  // Hide fields until needed
  drinks_fields.hide();
  food_fields.hide();
  
  $("input[name=choice]").on('click', function() {
  
      if ( $(this).val() == 'Drinks' ) {
          
          // Show drinks hide food
          drinks_fields.show();
          food_fields.hide();
          
          // Update required
          $("input[name=drinks]").prop('required',true);
          $("input[name=food]").prop('required',false);
          
      } else if ( $(this).val() == 'Food' ) {
          
          // Show food hide drinks
          food_fields.show();
          drinks_fields.hide();
          
          // Update required
          $("input[name=food]").prop('required',true);
          $("input[name=drinks]").prop('required',false);
      
      }
      
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form data-parsley-validate="true"&gt;
      
     &lt;fieldset&gt;
         &lt;legend&gt;Choice&lt;/legend&gt;
         &lt;input type="radio" name="choice" value="Drinks" required data-parsley-error-message="Choose drinks or food"/&gt;Drinks
         &lt;input type="radio" name="choice" value="Food"/&gt;Food
     &lt;/fieldset&gt;
      
     &lt;fieldset id="drinks"&gt;
         &lt;legend&gt;Drinks&lt;/legend&gt;
         &lt;input type="checkbox" name="drinks" data-parsley-mincheck="2" data-parsley-trigger="change" data-parsley-error-message="Choose min 2 drinks"/&gt;Water
         &lt;input type="checkbox" name="drinks"/&gt;Pepsi
         &lt;input type="checkbox" name="drinks"/&gt;Orange Juice
     &lt;/fieldset&gt;
      
     &lt;fieldset id="food"&gt;
         &lt;legend&gt;Food&lt;/legend&gt;
         &lt;input type="checkbox" name="food" data-parsley-mincheck="2" data-parsley-trigger="change" data-parsley-error-message="Choose min 2 foods"/&gt;Cake
         &lt;input type="checkbox" name="food"/&gt;Hotdog
         &lt;input type="checkbox" name="food"/&gt;Pizza
     &lt;/fieldset&gt;
         
     &lt;button type="submit"&gt;submit&lt;/button&gt;
  
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>