Solved

load a page from a client side vbscript event handler...

Posted on 2001-08-29
10
299 Views
Last Modified: 2008-02-01
I have a page with three radio buttons all named the same.  I also have an onclick vbscript event handler for the three radio buttons.  From the event handler, I would like to load another page, sort of like a form post, but without the form tags and submit button...any suggestions?

Preece
0
Comment
Question by:Preece
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 6

Accepted Solution

by:
JonFish85 earned 50 total points
ID: 6438341
try this maybe?

add this code right before the </HEAD> tag in your code:

<SCRIPT language=javascript>
<!--
function redirpage(pg)
{
  window.location.replace pg;
}
//-->
</SCRIPT>

then do something like this for your buttons:
<INPUT type=radio onclick="redirpage('test1.htm');">Test</INPUT>
<INPUT type=radio onclick="redirpage('test2.htm');"></INPUT>

hope this helps!
0
 

Expert Comment

by:agzis
ID: 6438342
You have 2 options:
 1. use window.open(...) method but the solution will use "GET" method.

 2. use form with all hidden members, method "post", obviosly and without submit button. Then programmicly modify send it using form.submit() method in your onclick
event.
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6438346
Something like this?

<script language=javascript>
  function fnSubmit()
  {
  document.MyForm.action="EmailPassword.asp";
  document.MyForm.method="post";
  document.MyForm.submit();
  return false;
  }
</script>

onclick="javascript:return fnSubmit()"
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 12

Author Comment

by:Preece
ID: 6438351
agzis:

Could you please provide a simple example for both options?

Thanks,
Preece
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6438354
sorry, maybe I didnt realize you need to submit a form...
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6438447
Hi Preece,

I have already given you the example for # 2  :)
0
 

Expert Comment

by:agzis
ID: 6438482
Hi,
  JonFish85 almost gave you my 1st solution. My second solution is here.


put this somewhere in your ASP/HTML page:

<form name="frm1" method="POST" action="asdasd.asp">
  <input name="in1" type="hidden" value="1">
</form>

to submit use this:
   document.frm1.submit();
to access value of hidden field:
   document.frm1.in1.value = somevalue;
0
 
LVL 12

Author Comment

by:Preece
ID: 6438628
Thanks guys for the help and greate examples.  I am giving the points to JonFish because window.location.replace worked for my without the use of a form or submit and I did it using vbscript instead of javascript:  


<input type=radio name="optSortBy" value="a" onclick="gsnSortBy(value)" checked>Apples  
<input type=radio name="optSortBy" value="b" onclick="gsnSortBy(value)">Bananas
<input type=radio name="optSortBy" value="c" onclick="gsnSortBy(value)">Cherries


<script language=vbscript>
sub gsnSortBy(sValue)
     window.location.replace "showfruit.asp?sortby=" & sValue
end sub
</script>

Sincerely,
Preece
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6438644
glad I could help! thanks for the points and especially for the "A" grade!
0
 
LVL 12

Author Comment

by:Preece
ID: 6438652
I'm just having a lot of fun learning asp!  Being a well experienced vb developer, asp and vbscript is a natural progression for me.  Also, it is amazing what you can do...I am actually creating a database web app that looks and behaves similarly to a vb app!  Thanks again!

Preece
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question