hyefive
01-15-2003, 02:20 AM
Hi,
I'm just getting started with javascript so any help with this will be greatly appreciated!
I have a page with a form on it.
The first field is named Search Type, with 2 radio button options, A and B.
A is the default, however when a user clicks B, a different set of search criteria follows beneath.
My thinking is to add a querystring (page.asp?SEARCH_TYPE=B) with a function then reload the page, collect the variable and carry on.
Here's what I have so far:
<%
SEARCH_TYPE = "A"
If Request.QueryString("SEARCH_TYPE") <> "" Then
SEARCH_TYPE = Request.QueryString("SEARCH_TYPE")
End If
%>
<html>
<head>
<script language="javascript">
function A_on(){
document.form1.action="page.asp?SEARCH_TYPE=A";
document.form1.submit();
}
function B_on(){
document.form1.action="page.asp?SEARCH_TYPE=B";
document.form1.submit();
}
</script>
</head>
<body>
...
<table>
<form action="page.asp" method="post" name="form1">
<tr>
<td>SEARCH TYPE:</td>
<td>
<input type="RADIO" name="SEARCH_TYPE value="A"<% If SEARCH_TYPE = "A" Then Response.Write " checked" End If %> onClick="A_on();">A<br>
<input type="RADIO" name="SEARCH_TYPE" value="B"<% If SEARCH_TYPE = "B" Then Response.Write " checked" End If %> onClick="B_on();">B
</td></tr>
.....
</form>
</table>
*** I used this method successfully elsewhere, but it's not working here. The difference is that on the successful one the form submits to a different page, and not to itself like this one does.
Is there some other way to "reload a page" using those functions instead of "submitting" it like they currently do?
Thank you!
Aaaaahhhhhhh!
:)
I'm just getting started with javascript so any help with this will be greatly appreciated!
I have a page with a form on it.
The first field is named Search Type, with 2 radio button options, A and B.
A is the default, however when a user clicks B, a different set of search criteria follows beneath.
My thinking is to add a querystring (page.asp?SEARCH_TYPE=B) with a function then reload the page, collect the variable and carry on.
Here's what I have so far:
<%
SEARCH_TYPE = "A"
If Request.QueryString("SEARCH_TYPE") <> "" Then
SEARCH_TYPE = Request.QueryString("SEARCH_TYPE")
End If
%>
<html>
<head>
<script language="javascript">
function A_on(){
document.form1.action="page.asp?SEARCH_TYPE=A";
document.form1.submit();
}
function B_on(){
document.form1.action="page.asp?SEARCH_TYPE=B";
document.form1.submit();
}
</script>
</head>
<body>
...
<table>
<form action="page.asp" method="post" name="form1">
<tr>
<td>SEARCH TYPE:</td>
<td>
<input type="RADIO" name="SEARCH_TYPE value="A"<% If SEARCH_TYPE = "A" Then Response.Write " checked" End If %> onClick="A_on();">A<br>
<input type="RADIO" name="SEARCH_TYPE" value="B"<% If SEARCH_TYPE = "B" Then Response.Write " checked" End If %> onClick="B_on();">B
</td></tr>
.....
</form>
</table>
*** I used this method successfully elsewhere, but it's not working here. The difference is that on the successful one the form submits to a different page, and not to itself like this one does.
Is there some other way to "reload a page" using those functions instead of "submitting" it like they currently do?
Thank you!
Aaaaahhhhhhh!
:)