• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2472
  • Last Modified:

passing multiple parameters in url using JS

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
HumanScaleDev
Asked:
HumanScaleDev
2 Solutions
 
Ryan ChongCommented:
try:

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

0
 
ZvonkoSystems architectCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now