Ok so here is my epic journey problem going on for a month now...:
First problem: I was building a form with coldfusion-ajax tags which was the worst mistake ever. IE completely hates it and I was unable to bind anything. YES, my code was correct. I had it verified by many people and many forums. So I have NO IDEA what was wrong.
So coldfusion ajax tags are out of the question..they won't work with my server setup...I don't know. (I don't control my server I work on)
So...now that i'm SOL and crying in my office like a crazy person... I have now decided to go around the problem by using jQuery + Coldfusion.
It isn't working either...
Here is the new problem: I need to have a select box that was pre-populated set a session variable. In other words:
I want to pass a form variable to a page that will set the session variable equal to that form variable...
Note: I'm using CF 8.
Here is my code so far:
form:
<form>
<select name="DeptCode" id = "dept">
<option value="NONE" selected>Choose a Department
<cfoutput query="getDepartments">
<option value="#DeptCode#">#DeptName#</option>
</cfoutput>
</select>
</form>
<cfoutput> #session.DeptCode#</cfoutput>
jQuery/Ajax:
<script language = "javascript">
$('#dept').change(
function() {
var datas = $('#dept').val();
$.ajax({
url: 'url:catch.cfc?method=getDept',
data: {dept: datas}
success: function(datas) { alert(datas); }
});
});
</script>
catch.cfc
<cfcomponent output="false">
<cffunction name="setDept" access="remote" returntype="any">
<cfargument name="dept" type="any" required="yes">
<cfset session.DeptCode = #argument.dept#>
<cfreturn />
</cffunction>
</cfcomponent>