Time:
Scotland: Fri, 11:00 pm
Rhode Island: Fri, 6:00 pm
Florida: Fri, 6:00 pm
New Mexico: Fri, 4:00 pm
California: Fri, 3:00 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information

For continued disscussion on this topic : Drop Down Menu onchange Bringing Down the Server


mindytruitt
07-07-2004, 11:45 PM
I am having trouble with getting a drop down menu, so that when an option is choosen then the page refreshes to reflect that choice. I made a tester page just to see if I can get it to work, but it keeps bringing down the server. Does anyone see anything wrong or how it can change it so the server doesnt keep going down??


<cfquery name="charge" datasource="literature">
select *
from Users, Chargeability
WHERE Users.sales >=3 AND Chargeability.FiscalYear = #URL.ID#
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>
</html>

Vincent Puglia
07-07-2004, 11:56 PM
Hi mindy,

correct me if I'm wrong. Your script queries a dbms and inserts part of the result into the selection list. Upon selecting a year you submit the page and do what? simply refresh or rerun the script?

where are you calling the goto function?

Vinny

mindytruitt
07-08-2004, 12:08 AM
I have actually changed my code since I posted, but the idea of this is to implement this code in another page so that when a different year is selected in the drop down menu, the page will refresh and show the data for that year instead. I am still a little new at JavaScript so I am not exactly sure how to go about it. This is my altered code. 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>
<body>
<form>
<table>
<tr>
<td width="125" bgcolor="#ccccff">
<div align="right">Fiscal Year:</div>
</td>
<td width="349" align="left">
<cfset currentYear = URL.ID>
<select name="fiscalYear" onchange="jump(this.options[this.selectedIndex].value);">
<option value="">Please Select a Year</option>
<option value=""></option>
<cfoutput>
<cfloop index="x" from="1" to="16" step="1">
<option value="#currentYear#">#currentYear#</option>
<cfset currentYear = currentYear + 1>
</cfloop>
</cfoutput>
</select>
</td>
</tr>
</table>
</form>
</body>
</html>

Vincent Puglia
07-08-2004, 01:12 AM
Hi Mindy,

with a quick glance this looks good, is it still crashing the server?

Vinny