• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

pass query id into pop up window

Guest
Dec 30, 2013 Dec 30, 2013

Copy link to clipboard

Copied

Hi,

i want to be able to pass the id from the query into the popup window but not sure how to do it, would you please help me with this? - thanks

code below (A) working fine with open the pop up detail page but din't know how to passs an id into detail page.

<!----A--->

  <script>

function openWin()

{

window.open("detail.cfm","_blank","toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");

}

</script>

<cfset foo = querynew('id_int,aNo_var,Renew,Cancel')>

   <cfloop query="getOrderHist">

      <cfset queryaddrow(foo)>

            <cfset querysetcell(foo,'id_int',getOrderHist.id_int)>

            <cfset querysetcell(foo,'aNo_var',getOrderHist.aNo_var)>

                    <cfset querysetcell(foo,'Renew','<a href="javascript: void(0);" onclick="openWin()">view</a>')>

   </cfloop>

<!---B--->

I try to call the page directly such as below but got an error for  "invalid character"

<cfset foo = querynew('id_int,aNo_var,Renew,Cancel')>

   <cfloop query="getOrderHist">

      <cfset queryaddrow(foo)>

            <cfset querysetcell(foo,'id_int',getOrderHist.id_int)>

            <cfset querysetcell(foo,'aNo_var',getOrderHist.aNo_var)>

    <cfset querysetcell(foo,'Renew','<a href="javascript: void(0);" onclick="window.open("detail.cfm?id=#id#","_blank");>renew</a>')>

   </cfloop>

Views

669

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Dec 31, 2013 Dec 31, 2013

you have an 'openWin' function, but then you're trying to add inline JS to do the same thing.  I assume that later on you're looping over your 'foo' query outputting these links to renew.  In which case I'd want to simply pass either a URL or just the ID into the openWin function.  Much simpler than trying to add dynamic JS into a query cell.

I'm slightly confused as well why you're creating a new query, foo, when you already have the query getOrderHist which seems to have everything you need.

fun

...

Votes

Translate

Translate
Engaged ,
Dec 31, 2013 Dec 31, 2013

Copy link to clipboard

Copied

you have an 'openWin' function, but then you're trying to add inline JS to do the same thing.  I assume that later on you're looping over your 'foo' query outputting these links to renew.  In which case I'd want to simply pass either a URL or just the ID into the openWin function.  Much simpler than trying to add dynamic JS into a query cell.

I'm slightly confused as well why you're creating a new query, foo, when you already have the query getOrderHist which seems to have everything you need.

function openWin(id) {

    window.open("detail.cfm?id=" + id, "_blank","toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");

}

<cfoutput query="getOrderHist">

    ID: #getOrderHist.id_int#<br>

    aNo: #getOrderHist.aNo_var#<br>

    <a href="" onclick="openWin(#getOrderHist.id_int#); return false;">Renew</a><br>

</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 31, 2013 Dec 31, 2013

Copy link to clipboard

Copied

LATEST

worked, thanks millions

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation