<%= form_for('',
             :html => { :multipart => true },
             :url => {:controller => 'exercise',
                      :action => 'commit_exercise',
                      :id => exercise.id
             },:remote=>true ) do |f| %>
<div class="ur_buttons">
  <a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
  <div class="polls_cha">
    <%= f.check_box 'show_result', :value => exercise.show_result%>
    <%= label_tag '_show_result', '允许学生查看测验结果' %>
    <!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
    <label for="">允许学生查看测验结果</label>-->
  </div>
</div>
<% end %>

<script type="text/javascript">
    function poll_submit() {
        var question_form = $("form.new_exercise_question");
        if($("#polls_head_edit").is(":visible")){
            alert("请先保存测验标题及测验基本信息。");
        } else if(question_form.length > 0) {
            alert("请先保存正在编辑的题目。");
        } else{
            $('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
            showModal('ajax-modal', '400px');
            //$('#ajax-modal').css('height','120px');
            $('#ajax-modal').siblings().remove();
            $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
                    "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
            $('#ajax-modal').parent().removeClass("alert_praise");
            $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
            $('#ajax-modal').parent().addClass("popbox_polls");
        }
    }
</script>