Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2001-08-29
10
300 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…

792 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