title: Rails: Foundation 5 Reveal Modal to Submit Button
body: <p>I have a form in which half of it is on a "<em>Targeting</em>" Reveal Modal. For example, the user will fill out certain fields in the form, click a next (in which is named "<em>Define Targeting</em>") button in which a modal pops up to finish the form.</p>
  
  <p>When they click the "<em>Done</em>" submit button, I would like it to save and close the modal and stay on the main form page.</p>
  
  <p>The issue I am having is that it does not save my record as long as I have the <code>class: "close-reveal-modal"</code>. When removed, it saves the record but it does then I lose it's ability to close the modal.</p>
  
  <p>Here is the submit button..</p>
  
  <pre><code>&lt;%= f.submit "Done", class: "close-reveal-modal", remote: true %&gt;
  </code></pre>
  
  <p>..and extra Javascript to trigger the submit.</p>
  
  <pre><code>$(document).ready(function(){
      $(".close-reveal-modal").click(function(){
  
          var isSelected = $("#campaign_plan_id").val();
  
          if (isSelected.length &gt; 0){
              $('form#new_campaign').trigger('submit.rails');
              $("#target-button").hide();
              $("#campaign-create-button").css("display", "block").css("background-color", "#E37368");
          }
      });
  }) 
  </code></pre>
  
  <p>Let me know if more clarity is needed and I'd be happy to add to the post. I'm learning Zurb through this process and Javascript isn't necessarily my forte. </p>