Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CF variable is Javascript

Status
Not open for further replies.

nohandlesleft254

IS-IT--Management
Apr 19, 2006
58
GB
Hi,

I'm using the below javascript function to get a pop-up to populate a field on the parent page. The problem is that i cant seem to get the CF variable in the Javascript.

Help...

function updateParent(DoorCode) {
opener.document.form_FindItem.DoorStyle.value = DoorCode
self.close();
return false;
}

onClick="updateParent(<cfoutput>#toScript(DoorRanges.Code, "jsVar")#;</cfoutput>)
 
because you are misunderstanding the way the toScript function works, take this example from livedocs:

Code:
<cfset thisString="hello world">
<script type="text/javascript" language="JavaScript">
   <cfoutput>
      var #toScript(thisString, "jsVar")#;
   </cfoutput>
</script>

When ColdFusion runs this code, it sends the following to the client:

<script type="text/javascript" language="JavaScript">
   var jsVar = "hello world";
</script>

so you should probably do something like:
Code:
<cfoutput>
    var #toScript(DoorRanges.Code, "jsVar")#;
</cfoutput>

onClick="updateParent(jsVar)"

=========================================
Don't sweat the petty things and don't pet the sweaty things.
 
yer got it - i ended up trying to use the toScript function because I was getting desperate. I realised just now that it was the javascript that was off... ARG!

Thanks for your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top