#1734 某竞赛主页中当搜索框为空时,点击搜索的提示问题

This commit is contained in:
sw 2014-12-23 15:13:16 +08:00
parent f834759d84
commit 30d8d82f37
2 changed files with 16 additions and 16 deletions

View File

@ -21,36 +21,36 @@
<td rowspan="2" >
<div class="project-search" style="float: right">
<script type="text/javascript">
function regexName()
function regexName1()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#contest_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#contest_name_span").css('color','#ff0000');
$("#contest_name_span").focus();
$("#contest_name_span_head").text("<%= l(:label_search_conditions_not_null) %>");
$("#contest_name_span_head").css('color','#ff0000');
$("#contest_name_span_head").focus();
return false;
}
else
{
$("#contest_name_span").text("");
$("#contest_name_span_head").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#contests_serch").submit();}
if(regexName1()){$("#contests_serch").submit();}
}
</script>
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName();' %>
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName1();' %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<br />
<span id="contest_name_span"></span>
<span id="contest_name_span_head"></span>
</div>
</td>
</tr>

View File

@ -37,37 +37,37 @@
</td>
<td rowspan="2" width="250px">
<script type="text/javascript">
function regexName()
function regexName1()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#contest_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#contest_name_span").css('color','#ff0000');
$("#contest_name_span").focus();
$("#contest_name_span_head").text("<%= l(:label_search_conditions_not_null) %>");
$("#contest_name_span_head").css('color','#ff0000');
$("#contest_name_span_head").focus();
return false;
}
else
{
$("#contest_name_span").text("");
$("#contest_name_span_head").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#contst_search_form").submit();}
if(regexName1()){$("#contst_search_form").submit();}
}
</script>
<div class="project-search">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get, :id => "contst_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName();' %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();' %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<span id="contest_name_span"></span>
<span id="contest_name_span_head"></span>
<% end %>
</div>
</td>