Skip to main content
Known Participant
May 16, 2006
Answered

database driven pull down menu with jscript?

  • May 16, 2006
  • 2 replies
  • 518 views
Hi,
I have a javascript pull down menu in top menu of a website in Cold Fsuion code. How do I get the pull down menu items from database?
like list of products.
thanks in advance.
    This topic has been closed for replies.
    Correct answer drforbin1970
    You can run a CFQUERY against your database called myQuery.

    JavaScript first line
    <cfoutput query="myQuery">
    JavaScript menu item code, <cfoutput>#product_name#</cfoutput>
    </cfoutput>
    JavaScript last line

    You get the idea.

    2 replies

    drforbin1970Correct answer
    Inspiring
    May 17, 2006
    You can run a CFQUERY against your database called myQuery.

    JavaScript first line
    <cfoutput query="myQuery">
    JavaScript menu item code, <cfoutput>#product_name#</cfoutput>
    </cfoutput>
    JavaScript last line

    You get the idea.
    Inspiring
    May 16, 2006
    Step 1, run your query. I assume it's 2 columns (name and id).

    Step 2. Convert each query column to an array using ListToArray and ValueList. (note, the query columns actually are arrays. If you can figure out the syntax, you might not need the functions.)

    Step 3. Use the ColdFusion toScript function to convert your Cold Fusion Variables to js variables.

    Step 4. Use these two variables to produce your menu.
    ShidaAuthor
    Known Participant
    May 16, 2006
    the server I am using is version 5 and doesn't support cfcsript.
    now what do I do?

    thanks.