?
Solved

passing multiple parameters in url using JS

Posted on 2009-04-09
2
Medium Priority
?
2,454 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 53

Accepted Solution

by:
Ryan Chong earned 1600 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 400 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

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

762 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