<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
  <div class="upload_con">
    <h2>选择问卷导入本课程</h2>
        <div class="upload_box">
          <div id="error_show" style="color: red;"></div>
          <%= form_tag import_other_poll_poll_index_path,
                       method: :post,
                       remote: true,
                       id: "relation_file_form" do %>
              <input type="hidden" name="course_id" value="<%= polls_group_id%>" />
              <%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
              <a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导&nbsp;&nbsp;入</a>
              <a href="javascript:void(0)" class="blue_btn grey_btn fl c_white "  onclick="closeModal();">取&nbsp;&nbsp;消</a>
          <% end -%>
        </div>


  </div>
</div>

<script>
    function submit_quote() {
        $('#error_show').html('');
        var selected = false;
       for(var i = 0; i < $("input[name='polls[]']").length;i++){
           if($("input[name='polls[]']")[i].checked){
               selected = true;
           }
       }
        if (selected){
            $('#submit_quote').parent().submit();
            closeModal();
        }else{
            $('#error_show').html('您没有选择任何问卷');
        }
    }
</script>