Hi there, I've got a little question...
I want a dropdown box that displays a table with two coloums. One is text, the other one's a date.
I've done this with:
<cfloop query="auftrag_filter">
<cfoutput><option value="#auftrag_filter.id#
">#bezeich
nung# (#DateFormat(termin_datum,
'dd.mm.yyy
y')#)</opt
ion></cfou
tput>
</cfloop>
that works, but the problem I have now is that I would like the the page to reload after I make a selection. Tried it with a javascript but doesn't work so far...
<script language="javascript" type="text/javascript">
<!--
function reloadPage() {
window.location.href="betr
eut_filter
.cfm?auftr
ag_id="+do
cument.get
ElementByI
d("auftrag
_auswahl")
.value;
}
-->
</script>
<cfquery name="auftrag_filter" datasource="mvs">
SELECT bezeichnung, termin_datum, id
FROM auftrag
ORDER BY bezeichnung
</cfquery>
<cfif IsDefined('auftrag_id') >
<select name="autrag_id" id="auftrag_auswahl" onchange="reloadPage();">
<cfloop query="auftrag_filter">
<cfoutput>
<option value="#auftrag_filter.id#
" <cfif #URL.auftrag_id# is #auftrag_filter.id#> selected="selected"</cfif>
>#bezeichnung# (#DateFormat(termin_datum,
'dd.mm.yyy
y')#)</opt
ion>
</cfoutput>
</cfloop>
</select>
<cfelse>
<select name="autrag_id" id="auftrag_auswahl" onchange="reloadPage();">
<cfloop query="auftrag_filter">
<cfoutput><option value="#auftrag_filter.id#
">#bezeich
nung# (#DateFormat(termin_datum,
'dd.mm.yyy
y')#)</opt
ion></cfou
tput>
</cfloop>
<option value="null" selected="selected">Bitte auswählen</option>
</select>
</cfif>
The result is now that when I start the page I have "Bitte auswählen" in the Box. After changing to any entry, the browser gives me the first value of the dropdown list back and not the selected one.
thanks for any help
Lukas
Start Free Trial