Solved

passing multiple parameters in url using JS

Posted on 2009-04-09
2
2,441 Views
Last Modified: 2013-12-16
I've been using  the code below to pass one variable from one page to the other:

I'm using Coldfusion flash forms on the page. The page calls the "tagging" cfsavecontent:
<cfsavecontent variable="tagging">
      var somevar = poID.text;
      getURL("javascript:newWin3('" + somevar + "');")
</cfsavecontent>

The cfsavecontent uses the script below to open an new window and pass the variables:

<SCRIPT type="text/javascript">
void function newWin3(poID){
var MyPage = "tagging.cfm?poID=" + poID;
window.open(MyPage,'mywindow', 'toolbar=no, height =750, width = 870, scrollbars=yes');
}
</SCRIPT>

The code doesn't work when passing multiple variables:
I've tried:

<cfsavecontent variable="attachmnt">
  var somevar = poID.text;
  var somsub = subject.text;
  getURL("javascript:newWin2('" + somevar,  + '&' + somsub +"');")
</cfsavecontent>

<SCRIPT type="text/javascript">
void function newWin2(poID, subject){
var MyPage = "attachments.cfm?ID=" + poID + "&sb=" + subject;
window.open(MyPage,'mywindow1');
}
</SCRIPT>

Is there a way this code can be modified so that it can pass multiple variables to another page?

I'd appreciate your help!

0
Comment
Question by:HumanScaleDev
[X]
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
2 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 400 total points
ID: 24107882
try:

<cfsavecontent variable="attachmnt">
  var somevar = poID.text;
  var somsub = subject.text;
  getURL("javascript:newWin2('" + somevar + "', '" + somsub +"');")
</cfsavecontent>

0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 100 total points
ID: 24140035
Change the & ampersond to , comma as proposed above and change slightly your JavaScript function:
<SCRIPT type="text/javascript">
// void is in JavaScript not required.
function newWin2(poID, subject){
  var MyPage = "attachments.cfm?ID=" + escape(poID) + "&sb=" + escape(subject);
  var nw=window.open(MyPage,'mywindow1','top=40,left=40,height=600,width=800');
  nw.focus();
}
</SCRIPT>

Open in new window

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

Title # Comments Views Activity
PHP: Filling Out/Creating a PDF 29 102
JS library vs Js framework 11 23
Video Tutorial help 2 39
Jquery Ajax - on change event not being picked up 9 30
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

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