-2

チェックボックスの値に基づいて検索を行っています。1 つのチェックボックスを選択すると、2 番目のチェックボックスを選択すると 1 つの値が必要になり、2 つのチェックボックスの値も必要になります。

現在、ラジオ ボタンを含むコードがあります。複数の選択肢があるチェックボックスに変換する必要があります。リクエスト値に基づいて、ストアド プロシージャに渡されます。

<% if request("view")="Key CIA Initiative" then %>
<input type="radio" checked="checked" 
   onclick="javascript:document.location='Index.asp?view=Key CIA Initiative'" />
<input type="radio" onclick="javascript:document.location='Index.asp?view=High'" />
<input type="radio"  onclick="javascript:document.location='Index.asp'" />

<% else %>

<% if request("view")="High" then %>
<input type="radio"  onclick="javascript:document.location='Index.asp?view=Key            
 Initiative'" />
<input type="radio" checked="checked" onclick="javascript:document.location='Index.asp?
view=High'" /> 
<input type="radio"  onclick="javascript:document.location='Index.asp'" />
<% else %>
<input type="radio"  onclick="javascript:document.location='Index.asp?view=Key CIA 
Initiative'" />
<input type="radio"  onclick="javascript:document.location='Index.asp?view=High'" />
<input type="radio"  onclick="javascript:document.location='Index.asp'" /> 
<%end if%>
<%end if%>       

ラジオボタンをクリックすると、リクエスト値と同じページにリダイレクトされ、ストアドプロシージャに渡されます

 If request("view")="Key CIA Initiative" Then
  strSQL = "Exec sp_get_Project_list 'Key CIA Initiative' "
 Else
 If  request("view")= "High" then
  strSQL="Exec sp_get_Project_list 'High' "
 Else 
  strSQL="Exec sp_get_Project_list "
 end if
 end if
4

1 に答える 1

0

次のようにする必要があります。

<%
Response.write "Request(view)="& request("view") & "<br />"
'Now, if request("view") has nultiple values, How are you going to call the sp? 
'pass both values to it?
If Trim(Request("view"))<>"" Then

    If InStr(Request("view"),"All")<>0 Then
        strSQL="Exec sp_get_Project_list"
    Else
    strSQL = "Exec sp_get_Project_list '"& Request("view") &"'"
    End if
Response.write "strSQL ="& strSQL & "<br />"
End If
%>
<form>
<input type="checkbox" name="view" value="Key CIA Initiative" <% if InStr(request("view"),"Key CIA Initiative")>0 then %> checked="checked"<%End If%> />Key CIA Initiative <br/>
<input type="checkbox" name="view" value="High" <%if InStr(request("view"),"High")>0 then %> checked="checked"<%End If%>  />High<br/>
<input type="checkbox" name="view" value="All" <%if InStr(request("view"),"All")>0 then %> checked="checked"<%End If%> />All <br/>
<input type="submit">
</form>
于 2013-06-20T09:53:18.950 に答える