新增题目时,增加标题不能为空的js验证

This commit is contained in:
sw 2015-01-29 16:53:11 +08:00
parent b71d714103
commit 108435f933
5 changed files with 12 additions and 4 deletions

View File

@ -34,7 +34,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -33,7 +33,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -13,7 +13,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -8,7 +8,7 @@
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -23,6 +23,14 @@
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
}
//确定按钮
function add_poll_question(obj)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){