Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 12th, 2003, 12:54 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default How Do I Pass 2 Variables in Javascript

Hi there

Could anyone help me with the following problem:

I've got a dropdown box which is populated from a database. The dropdown displays a TName but passes through TID.

<select name="TID" id="TID" onchange='JavaScript:window.location="pageurl_edit .asp?TID=" + this.value;'>

This all worked fine on my insert page but I need to tweak it for my edit page and am not really a javascript bod!

I need to pass through another variable called UID

On my edit page i've got some asp:
<%
Dim uid
if Request("uid") <> "" then uid = Request("uid")
%>

So, what I need to put in my select box onchange function is this:
pass through TID which is equal to the value of the select box (as before) and pass through UID which is equal to Request("uid") but I don't know how to write this in javascript.

Can anyone help?

Thanks in advance

Lucy

  #2 (permalink)  
Old December 12th, 2003, 05:18 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I think is what you want... UID is going to be the same for all TIDs right?

<select name="TID" id="TID" onchange="window.location='pageurl_edit.asp?TID=' + this.value + '&uid=<%=uid%>';">


Peter
------------------------------------------------------
Work smarter, not harder.
  #3 (permalink)  
Old December 13th, 2003, 11:25 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The slight problem with that solution is that it uses an IE only construct, a select element does not have a value in standard HTML. The general construct would be:
Code:
<select name="TID" id="TID" onchange="window.location='pageurl_edit.asp?TID=' + this.options[this.selectedIndex].value + '&uid=<%=uid%>';">
--

Joe


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass Variables obrienkev C# 2005 1 July 18th, 2008 03:58 AM
How do I Pass Session Variables cdanczak Classic ASP Professional 0 November 27th, 2007 10:42 AM
how can I pass variables to vb? astarti Beginning VB 6 4 September 5th, 2007 08:43 AM
Is it better to pass variables to a function? stephen_c_ Beginning PHP 3 November 4th, 2005 05:07 AM
Q. How do I pass PHP variables to JavaScript? Snib PHP FAQs 0 April 8th, 2004 11:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.