www.webdeveloper.com
Results 1 to 3 of 3

Thread: Converting Coldfusion to Javascript.

  1. #1
    Join Date
    Nov 2004
    Posts
    8

    Converting Coldfusion to Javascript.

    I have a site that used to use Coldfusion, and I would like to remove the CFOUTPUT tags code from the javascript. I would really like it converted to .net, but I've never seen a dropdown list populated dynamically from a file and not a database before.

    So I'll settle with the removal of the CF tags from the javascript. Could someone please help??

    <SCRIPT LANGUAGE="JavaScript">
    <!--- Populates the dropdown list for the symbols to be selected --->
    function getSymbols()
    {
    var map = getMainMap();
    var theSymColl = map.getSymbols();
    var opt = new Option("-- Select a symbol --", "null");
    eval("document.draw_form.draw_symbol_name.options[0]=opt");
    for (var i=0; i < theSymColl.size(); i++){
    var opt = new Option(theSymColl.item(i), theSymColl.item(i));
    eval("document.draw_form.draw_symbol_name.options[i+1]=opt");
    <CFIF ISDEFINED("DRAW_SYMBOL_NAME")>
    <CFOUTPUT>
    var selectedSym = "#DRAW_SYMBOL_NAME#";
    </CFOUTPUT>
    if (theSymColl.item(i) == selectedSym){
    document.draw_form.draw_symbol_name.options[i+1].selected=true;
    }
    </CFIF>
    }
    }
    </script>

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    To populate a drop down list from a db in .,net is very easy. You just need a data set and you are set. You can do it with the asp.net elements or just a loop and a standard html drop down list. Either way it is very easy to do. I could furnish code if you like.

  3. #3
    Join Date
    Nov 2004
    Posts
    8
    That's what I was trying to avoid was using a db and ds because then I have to maintain it. The way it currently works is that it extracts the list and symbols from an API. I've since decided to convert it all to asp.net and use a database. It's not idea but it gives me so many more options. I was able to get the functionality as well as add in new validation controls which is unavailable with javascript and html.

    So it's done now, but thanks for the options, it's much appreciated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles