Solved

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

Posted on 2001-08-29
10
301 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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