项目搜索,增加搜索条件不能为空的提示

This commit is contained in:
sw 2014-12-19 14:39:24 +08:00
parent ff49fbe5c8
commit c6be2317a7
1 changed files with 32 additions and 4 deletions

View File

@ -40,10 +40,38 @@
</td> </td>
<td rowspan="2" width="250px"> <td rowspan="2" width="250px">
<div class="top-content-search"> <div class="top-content-search">
<%= form_tag(projects_search_path, :method => :get) do %> <script type="text/javascript">
<%= text_field_tag 'name', params[:name], :size => 20 %> function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();" %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%#= 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>
<br />
<span id="project_name_span"></span>
<% end %> <% end %>
</div> </div>
</td> </td>