I am a little stuck trying to figure out how to create a drop down box so that when you click on a value it automatically transfers you to another page or refresh that page to adjust for the value that was clicked on.
<Script language="JavaScript"> function goto(form) { var index=form.select.selectedIndex if (form.select.options[index].value != "0") { location=form.select.options[index].value;}} </SCRIPT>
I tried to just see if I could get the drop down box to work and made its own page but It still causes the server to overrun and I have to restart. Does anyone see a problem with this code?
<cfquery name="charge" datasource="literature"> select * from Users, Chargeability WHERE Users.sales >=3 AND #URL.ID# = Chargeability.FiscalYear Order By UserName </cfquery>
<script language="javaScript"> <!--
function goto(form){var index=form.select.selectedIndex if(form.select.options[index].value !="0") { location=form.select.options[index].value;}} //--> </script>
<html> <body> <cfoutput> Fiscal Year: <cfset year=#URL.ID#></cfoutput> <select name = "FiscalYear" onchange="this.form.submit();"> <cfoutput> <cfloop index="x" from="0" to="16" step="1"> <option value=tester.cfm?ID=#year#>#year# <cfset year = year + 1> </option> </cfloop> </cfoutput> </select>
<cfquery name="charge" datasource="literature"> SELECT * FROM users, chargeability WHERE Users.sales >=3 AND Chargeability.FiscalYear = <cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_integer"> ORDER BY userName </cfquery>
<html>
<head> <script type="text/javascript"> function jump(yr) { if (yr != "") { location.href="tester.cfm?ID=" + yr; } } </script> </head>
made a few changes...most notably adding a couple of blank options at the top of the <select>. without those, your onchange() function means the user will never have the option of selecting the first year in the list.
also assumed that the SQL needed to be switched around a little (as per my previous post).
I ended up just coping and pasting the code you had showed me and tried running that but it still has the problem. I run the page as "Tester.cfm?ID=2004" which I assume is right but just checking.
Thanks - Mindy
<cfquery name="charge" datasource="literature"> SELECT * FROM users, chargeability WHERE Users.sales >=3 AND Chargeability.FiscalYear = <cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_integer"> ORDER BY userName </cfquery>
<html>
<head> <script type="text/javascript"> function jump(yr) { if (yr != "") { location.href="tester.cfm?ID=" + yr; } } </script> </head>