I need to change this javascript funtion into all javascript. I need the cfif
isdefine, and cfoutput removed. Could someone PLEASE show me how to do this?
Thanks,
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>
}
}
blewis - 30 Nov 2004 01:28 GMT
Not really possible. The
<CFIF ISDEFINED("DRAW_SYMBOL_NAME")>
is checking a CF variable server side. JS cannot do this. JS is purely client-side scripting.
Bryan
vkunirs - 30 Nov 2004 09:03 GMT
hi by doing some changes we can do this. try in this way. <script> var
dramsymbolname=0; </script> <CFIF ISDEFINED('DRAW_SYMBOL_NAME')> <CFOUTPUT>
<script language='javascript'> var selectedSym =
'#DRAW_SYMBOL_NAME#'; dramsymbolname=1;
</script> </CFOUTPUT> </cfif> 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'); if
(drawsymbolname=1) {
if (theSymColl.item(i) == selectedSym){
document.draw_form.draw_symbol_name.options[i+1].selected=true; } }
} } i think this
will solve your problem. and here i have just written a sample code for you.
this is not as syntatically, please change as your requirements. thanks
Srinivas