Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / General CF Topics / July 2008



Tip: Looking for answers? Try searching our database.

pass query result as parameter to javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
biene22 - 29 Jul 2008 13:43 GMT
Hello,

I'm a beginner with javascript, so (maybe) sorry for this question.

Is it possible to use a query result as parameter in a javascript function
for example like this?

<cfquery name="select_data">
select name from user_table
</cfquery>

<script language="javascript">
function(#select_data.name#)
{
...
}
</script>

Background is: I have to validate an input field with some values which are
saved in a database table.
This values can be dynamic , so I don't want to put this values into the
cfm-file.

Any ideas?

Claudia
Dan Bracuk - 29 Jul 2008 14:13 GMT
Each column in a cf query is effectively a 1D array.  You can use the toscript function to send this array to js.
GArlington - 30 Jul 2008 11:13 GMT
> Hello,
>
[quoted text clipped - 22 lines]
>
>  Claudia

Agree with Dan...
You may take a look at <cfwddx .../> too.
P.S. You need to define a function only once
<script language="javascript">
yourFunction(yourArray) {
...
}
</script>
and then call it as often as you like with various values:
yourFunction(yourArray1), yourFunction(yourArray2)...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.