Solved

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

Posted on 2001-08-29
10
297 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now