1.软件创客搜索功能修改表单提交为在js中提交

2.增加判断搜索条件是不是为空
This commit is contained in:
sw 2014-07-14 16:29:59 +08:00
parent 90e28518f2
commit 8f8fb79a63
3 changed files with 32 additions and 8 deletions

View File

@ -329,7 +329,7 @@ class UsersController < ApplicationController
when 'xml', 'json' when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15}) @offset, @limit = api_offset_and_limit({:limit => 15})
else else
@limit = 15#per_page_option @limit = 15#per_page_option
end end
@status = params[:status] || 1 @status = params[:status] || 1

View File

@ -1,6 +1,18 @@
<!-- modified by huang --> <!-- modified by huang -->
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_user_form").submit();
}
</script>
<div class="top-content"> <div class="top-content">
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px"> <table width="940px">
<tr> <tr>
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_software_user ) %></td> <td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_software_user ) %></td>
@ -9,8 +21,9 @@
</td> </td>
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -1,7 +1,17 @@
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_user_form").submit();
}
</script>
<div class="top-content"> <div class="top-content">
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px"> <table width="940px">
<tr> <tr>
<td class="info_font" style="width: 220px; color: #15bccf "><%= l(:label_software_user ) %></td> <td class="info_font" style="width: 220px; color: #15bccf "><%= l(:label_software_user ) %></td>
@ -10,8 +20,9 @@
</td> </td>
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div> </div>
</td> </td>
</tr> </tr>