Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-15-2003, 02:20 AM   PM User | #1
hyefive
New Coder

 
Join Date: Oct 2002
Location: Oakland, CA
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
hyefive is on a distinguished road
reload page w/ querystring using onclick

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!
hyefive is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:58 AM.


Advertisement
Log in to turn off these ads.