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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I wanted to know if there 2

Status
Not open for further replies.

ANGELFIRE

Technical User
Joined
Sep 22, 2001
Messages
8
Location
US
Hi,

I wanted to know if there is a way to access cold fusion variables in javascript. I get some data using cfquery. i want to use that data inside my javascript to do some checking. is there a way to access the cfquery variables in js. I would really appreciate any help in this matter. Thank You.

 
Hi angelfire,

You can probably find more Details on this by searching the FAQS or even previous posts but here is a small sample that should get you going:

<SCRIPT>
function testthis()
{
alert(&quot;CF VARIABLE is &quot; + document.MyForm.m.value);
}
</script>

<CFSET m = &quot;TESTME&quot;>
<CFFORM onsubmit=&quot;return testthis();&quot; METHOD=&quot;Post&quot; name=&quot;MyForm&quot; action=&quot;test.cfm&quot;>
<input type=&quot;hidden&quot; name=&quot;m&quot; value=&quot;<cfoutput>#m#</cfoutput>&quot;>
<input type=&quot;submit&quot;>
</cfform>

Javascript can access hidden form variables so that is a good way to do it.

There has been a lot of discussion on this though and I suggest you search through it because you will find much more detail.

Hope it works for you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top