erikTsomik
asked on
cfquery problems in coldfusion
I have form where I am trying to sort the content of the drop down. My where clause is based upon session varibale that was passed from the first screen. The session varibale is created and exists until I pressing the submit button. the form submits to itself . After the submit is pressed then session variable is desapearing . I do not know why ?
<cfquery name="SetOrder" datasource="HotBanana_Mana ger">
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo lcode#'
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
<cfquery name="SetOrder" datasource="HotBanana_Mana
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
ASKER
I will post you the code. The session variable gets set in the function called GenerateAdmissionsWizardte xt
<cfcomponent displayname="newPsa" extends="hb50.tool">
<cffunction name="mainMenu" >
<cfargument name="stepId" required="yes" type="string">
<cfsavecontent variable="output">
<cfoutput>
<cfif stepId eq "1">
<cfoutput>
#school()# </cfoutput>
</cfif>
<cfif ((stepId eq "business") or (stepId eq "education") or (stepId eq "psl")) >
<cfoutput>
#GenerateAdmissionsWizardT ext (stepId,degree)# </cfoutput>
</cfif>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="school" >
<cfsavecontent variable="output">
<cfquery name="school" datasource="HotBanana_Mana ger">
select distinct school_division from trnAcademicPrograms
</cfquery>
<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="JavaScript" type="text/javascript">
function validateForm(objForm){
var strErr='';
if(!objForm.school.options [objForm.s chool.sele ctedIndex] .value){
strErr='Invalid Selection!\nUnable to submit form.\nPlease make a valid selection and try again.'
}
if(strErr){
alert(strErr);
}else{
objForm.action='?debug&ste p='+objFor m.school.o ptions[obj Form.schoo l.selected Index].val ue;
}
return !strErr;
}
</script>
<div id="menuOption">
<h2 style="margin:20px;">Pleas e select a desired school:</h2>
<form action="" method="post" enctype="multipart/form-da ta" onSubmit="return validateForm(this);" >
<select name="school" id="school">
<option>[Please select a school]</option>
<cfloop query="school"><option value="#school_division#"> #school_di vision#</o ption> </cfloop>
</select>
<input type="submit" value="Select School" id="btnsubmit" >
</form>
</div>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="GenerateAdmissionsWi zardText">
<cfargument name="stepId" required="yes" type="string">
<cfargument name="degree" required="yes" type="string">
<cfsavecontent variable="output">
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc hool>
<link href="/spry/widgets/tabbed panels/Spr yTabbedPan els.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/spry/widgets/tabbedp anels/Spry TabbedPane ls.js"></s cript>
<script type="text/javascript">
function Field_up(lst) {
var i = lst.selectedIndex;
if (i>0) Field_swap(lst,i,i-1);
}
function Field_down(lst) {
var i = lst.selectedIndex;
if (i<lst.length-1) Field_swap(lst,i+1,i);
}
function Field_swap(lst,i,j) {
var t = '';
t = lst.options[i].text; lst.options[i].text = lst.options[j].text; lst.options[j].text = t;
t = lst.options[i].value; lst.options[i].value = lst.options[j].value; lst.options[j].value = t;
t = lst.options[i].selected; lst.options[i].selected = lst.options[j].selected; lst.options[j].selected = t;
t = lst.options[i].defaultSele cted; lst.options[i].defaultSele cted = lst.options[j].defaultSele cted; lst.options[j].defaultSele cted = t;
}
function SetFields(lst,lstSave) {
var t;
lstSave.value=""
for (t=0;t<=lst.length-1;t++)
lstSave.value+=String(lst. options[t] .value)+", ";
if (lstSave.value.length>0)
lstSave.value=lstSave.valu e.slice(0, -1);
}
</script>
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGrou p">
<li class="TabbedPanelsTab" tabindex="0" >Category</li>
<li class="TabbedPanelsTab" tabindex="0" >SubCategory</li>
</ul>
<div class="TabbedPanelsContent Group">
<div class="TabbedPanelsContent ">
<div class="TabbedPanelsContent ">
<cfstoredproc procedure="spWebProgramLis t" datasource="#this.datasour ce#">
<cfprocparam type="in" cfsqltype="cf_sql_varchar" variable="@school" value="#session.schoolcode #">
<cfprocresult name="request.programlist" >
</cfstoredproc>
<cfif session.schoolcode eq "psl">
<h2>Step 1: Select Your Program</h2>
<cfelse>
<h2>Step 1: Select Your Area of Interest</h2>
</cfif>
<cfoutput><p>Thank you for choosing the #session.schoolname#.<cfif session.schoolcode eq "business"> <strong>Please note that all applications to the Carey Business School should be submitted via the Web using the online application. Paper applications are no longer accepted.</strong></cfif> The information and steps that follow should help you easily navigate the online admissions process. If you have additional questions, please don't hesitate to contact us at #session.appphonenumber# or email <a href="mailto:#session.appe mail#">#se ssion.appe mail#</a>. </cfoutput >
<!--- if school is PSL, set the URL param f to n, which waives the application fee--->
<cfoutput>
<cfif session.schoolcode eq "psl">
<form action="" method="post" enctype="multipart/form-da ta" name="category">
<cfelse>
<form action="" method="post" enctype="multipart/form-da ta" name="category" onsubmit="SetFields(docume nt.categor y.programl ist,docume nt.categor y.FieldsSa ve);">
</cfif>
<input type="hidden" Name="FieldsSave">
</cfoutput>
<cfif session.schoolcode eq "psl">
<cfoutput query="request.programlist " >
<h2>#category#</h2>
<label for="programlist" title="Area of interest"></label>
<select id="programlist" name="degree" multiple="true" size="#cnt#">
<cfoutput>
<option value="#id#">#webname#</op tion>
</cfoutput>
</select>
</cfoutput>
<cfelse>
<h2>Select an area of interest from the list below:</h2>
<select id="programlist" size="15">
<cfoutput query="request.programlist " group="category">
<option value="#categoryid#">#cate gory#</opt ion>
</cfoutput>
</select>
</cfif>
<div id="upDown">
<input type="button" id="moveUp" name="moveUp" value="MoveUp" onclick="javascript:Field_ up(documen t.category .programli st);"/>
<input type="button" id="moveDown" name="moveDown" value="moveDown" onclick="javascript:Field_ down(docum ent.catego ry.program list);"/>
</div>
<cfif session.schoolcode eq "psl">
<p> <input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Select"></p>
<cfelseif session.schoolcode eq "educaton">
<p><em>Inquiries about doctoral programs in education should be directed to the Department of Teacher Development and Leadership at 410-516-9755 or the Department of Special Education at 410-516-8275.</em></p>
</cfif>
<input type="submit" value="Submit" name="btnsubmit" id="btnsubmit2">
</form>
</div>
</div>
<div class="TabbedPanelsContent ">Content 3</div>
</div>
<cfparam name="form.FieldsSave" default="">
<cfif isDefined("btnsubmit")>
<cfset Order=1>
<cfloop list="#Form.FieldsSave#" index="field">
<cfquery name="SetOrder" datasource="HotBanana_Mana ger">
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo lcode#'
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
<cfdump var="#form#">
<cfdump var="#Form.FieldsSave#">
<cfoutput>
<script language="JavaScript" type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels(" TabbedPane ls1", { defaultTab: 0});
</script>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<!---Get Front End function--->
<cffunction name="getFrontEnd">
<cfset var output = StructNew()>
<cfset output.title ="">
<cfset output.blnHideContent = false>
<cfparam name="URL.degree" default="">
<cfparam name="URL.step" default="1">
<cfset stepCardinality=Left("#URL .step#", 1)>
<cfsavecontent variable="output.body">
<cfoutput>
#mainMenu(url.step)# </cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
</cfcomponent>
<cfcomponent displayname="newPsa" extends="hb50.tool">
<cffunction name="mainMenu" >
<cfargument name="stepId" required="yes" type="string">
<cfsavecontent variable="output">
<cfoutput>
<cfif stepId eq "1">
<cfoutput>
#school()# </cfoutput>
</cfif>
<cfif ((stepId eq "business") or (stepId eq "education") or (stepId eq "psl")) >
<cfoutput>
#GenerateAdmissionsWizardT
</cfif>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="school" >
<cfsavecontent variable="output">
<cfquery name="school" datasource="HotBanana_Mana
select distinct school_division from trnAcademicPrograms
</cfquery>
<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="JavaScript" type="text/javascript">
function validateForm(objForm){
var strErr='';
if(!objForm.school.options
strErr='Invalid Selection!\nUnable to submit form.\nPlease make a valid selection and try again.'
}
if(strErr){
alert(strErr);
}else{
objForm.action='?debug&ste
}
return !strErr;
}
</script>
<div id="menuOption">
<h2 style="margin:20px;">Pleas
<form action="" method="post" enctype="multipart/form-da
<select name="school" id="school">
<option>[Please select a school]</option>
<cfloop query="school"><option value="#school_division#">
</select>
<input type="submit" value="Select School" id="btnsubmit" >
</form>
</div>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="GenerateAdmissionsWi
<cfargument name="stepId" required="yes" type="string">
<cfargument name="degree" required="yes" type="string">
<cfsavecontent variable="output">
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc
<link href="/spry/widgets/tabbed
<script type="text/javascript" src="/spry/widgets/tabbedp
<script type="text/javascript">
function Field_up(lst) {
var i = lst.selectedIndex;
if (i>0) Field_swap(lst,i,i-1);
}
function Field_down(lst) {
var i = lst.selectedIndex;
if (i<lst.length-1) Field_swap(lst,i+1,i);
}
function Field_swap(lst,i,j) {
var t = '';
t = lst.options[i].text; lst.options[i].text = lst.options[j].text; lst.options[j].text = t;
t = lst.options[i].value; lst.options[i].value = lst.options[j].value; lst.options[j].value = t;
t = lst.options[i].selected; lst.options[i].selected = lst.options[j].selected; lst.options[j].selected = t;
t = lst.options[i].defaultSele
}
function SetFields(lst,lstSave) {
var t;
lstSave.value=""
for (t=0;t<=lst.length-1;t++)
lstSave.value+=String(lst.
if (lstSave.value.length>0)
lstSave.value=lstSave.valu
}
</script>
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGrou
<li class="TabbedPanelsTab" tabindex="0" >Category</li>
<li class="TabbedPanelsTab" tabindex="0" >SubCategory</li>
</ul>
<div class="TabbedPanelsContent
<div class="TabbedPanelsContent
<div class="TabbedPanelsContent
<cfstoredproc procedure="spWebProgramLis
<cfprocparam type="in" cfsqltype="cf_sql_varchar"
<cfprocresult name="request.programlist"
</cfstoredproc>
<cfif session.schoolcode eq "psl">
<h2>Step 1: Select Your Program</h2>
<cfelse>
<h2>Step 1: Select Your Area of Interest</h2>
</cfif>
<cfoutput><p>Thank you for choosing the #session.schoolname#.<cfif
<!--- if school is PSL, set the URL param f to n, which waives the application fee--->
<cfoutput>
<cfif session.schoolcode eq "psl">
<form action="" method="post" enctype="multipart/form-da
<cfelse>
<form action="" method="post" enctype="multipart/form-da
</cfif>
<input type="hidden" Name="FieldsSave">
</cfoutput>
<cfif session.schoolcode eq "psl">
<cfoutput query="request.programlist
<h2>#category#</h2>
<label for="programlist" title="Area of interest"></label>
<select id="programlist" name="degree" multiple="true" size="#cnt#">
<cfoutput>
<option value="#id#">#webname#</op
</cfoutput>
</select>
</cfoutput>
<cfelse>
<h2>Select an area of interest from the list below:</h2>
<select id="programlist" size="15">
<cfoutput query="request.programlist
<option value="#categoryid#">#cate
</cfoutput>
</select>
</cfif>
<div id="upDown">
<input type="button" id="moveUp" name="moveUp" value="MoveUp" onclick="javascript:Field_
<input type="button" id="moveDown" name="moveDown" value="moveDown" onclick="javascript:Field_
</div>
<cfif session.schoolcode eq "psl">
<p> <input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Select"></p>
<cfelseif session.schoolcode eq "educaton">
<p><em>Inquiries about doctoral programs in education should be directed to the Department of Teacher Development and Leadership at 410-516-9755 or the Department of Special Education at 410-516-8275.</em></p>
</cfif>
<input type="submit" value="Submit" name="btnsubmit" id="btnsubmit2">
</form>
</div>
</div>
<div class="TabbedPanelsContent
</div>
<cfparam name="form.FieldsSave" default="">
<cfif isDefined("btnsubmit")>
<cfset Order=1>
<cfloop list="#Form.FieldsSave#" index="field">
<cfquery name="SetOrder" datasource="HotBanana_Mana
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
<cfdump var="#form#">
<cfdump var="#Form.FieldsSave#">
<cfoutput>
<script language="JavaScript" type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("
</script>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<!---Get Front End function--->
<cffunction name="getFrontEnd">
<cfset var output = StructNew()>
<cfset output.title ="">
<cfset output.blnHideContent = false>
<cfparam name="URL.degree" default="">
<cfparam name="URL.step" default="1">
<cfset stepCardinality=Left("#URL
<cfsavecontent variable="output.body">
<cfoutput>
#mainMenu(url.step)# </cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
</cfcomponent>
here is the problem
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc hool>
teh session var is set to '' whenteh form is submitted, you need to change this processing to validate before setting teh session var
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc
teh session var is set to '' whenteh form is submitted, you need to change this processing to validate before setting teh session var
you can fix this by adding a hidden field to teh second form
<input type="hidden" value='#session.schoolcode #" name="school">
<input type="hidden" value='#session.schoolcode
ASKER
I added the hidden field to the second form but still the query does ncot receive the schoolcode
<cfcomponent displayname="newPsa" extends="hb50.tool">
<cffunction name="mainMenu" >
<cfargument name="stepId" required="yes" type="string">
<cfsavecontent variable="output">
<cfoutput>
<cfif stepId eq "1">
<cfoutput>
#school()# </cfoutput>
</cfif>
<cfif ((stepId eq "business") or (stepId eq "education") or (stepId eq "psl")) >
<cfoutput>
#GenerateAdmissionsWizardT ext (stepId,degree)# </cfoutput>
</cfif>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="school" >
<cfsavecontent variable="output">
<cfquery name="school" datasource="HotBanana_Mana ger">
select distinct school_division from trnAcademicPrograms
</cfquery>
<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="JavaScript" type="text/javascript">
function validateForm(objForm){
var strErr='';
if(!objForm.school.options [objForm.s chool.sele ctedIndex] .value){
strErr='Invalid Selection!\nUnable to submit form.\nPlease make a valid selection and try again.'
}
if(strErr){
alert(strErr);
}else{
objForm.action='?debug&ste p='+objFor m.school.o ptions[obj Form.schoo l.selected Index].val ue;
}
return !strErr;
}
</script>
<cfparam name="form.school" default="">
<cfparam name="form.session" default="">
<cfset session.schoolcode=form.sc hool>
<cfoutput>session:#session .schoolcod e#</cfoutp ut>
<div id="menuOption">
<h2 style="margin:20px;">Pleas e select a desired school:</h2>
<form action="" method="post" enctype="multipart/form-da ta" onSubmit="return validateForm(this);" >
<select name="school" id="school">
<option>[Please select a school]</option>
<cfloop query="school"><option value="#school_division#"> #school_di vision#</o ption> </cfloop>
</select>
<input type="submit" value="Select School" id="btnsubmit" >
</form>
</div>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="GenerateAdmissionsWi zardText">
<cfargument name="stepId" required="yes" type="string">
<cfargument name="degree" required="yes" type="string">
<cfsavecontent variable="output">
<link href="/spry/widgets/tabbed panels/Spr yTabbedPan els.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/spry/widgets/tabbedp anels/Spry TabbedPane ls.js"></s cript>
<script type="text/javascript">
function Field_up(lst) {
var i = lst.selectedIndex;
if (i>0) Field_swap(lst,i,i-1);
}
function Field_down(lst) {
var i = lst.selectedIndex;
if (i<lst.length-1) Field_swap(lst,i+1,i);
}
function Field_swap(lst,i,j) {
var t = '';
t = lst.options[i].text; lst.options[i].text = lst.options[j].text; lst.options[j].text = t;
t = lst.options[i].value; lst.options[i].value = lst.options[j].value; lst.options[j].value = t;
t = lst.options[i].selected; lst.options[i].selected = lst.options[j].selected; lst.options[j].selected = t;
t = lst.options[i].defaultSele cted; lst.options[i].defaultSele cted = lst.options[j].defaultSele cted; lst.options[j].defaultSele cted = t;
}
function SetFields(lst,lstSave) {
var t;
lstSave.value=""
for (t=0;t<=lst.length-1;t++)
lstSave.value+=String(lst. options[t] .value)+", ";
if (lstSave.value.length>0)
lstSave.value=lstSave.valu e.slice(0, -1);
}
</script>
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc hool>
<!---<cfparam name="form.school" default="">--->
<input type="hidden" value="#session.schoolcode #" name="form.school">
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGrou p">
<li class="TabbedPanelsTab" tabindex="0" >Category</li>
<li class="TabbedPanelsTab" tabindex="0" >SubCategory</li>
</ul>
<div class="TabbedPanelsContent Group">
<div class="TabbedPanelsContent ">
<div class="TabbedPanelsContent ">
<cfstoredproc procedure="spWebProgramLis t" datasource="#this.datasour ce#">
<cfprocparam type="in" cfsqltype="cf_sql_varchar" variable="@school" value="#session.schoolcode #">
<cfprocresult name="request.programlist" >
</cfstoredproc>
<cfif session.schoolcode eq "psl">
<h2>Step 1: Select Your Program</h2>
<cfelse>
<h2>Step 1: Select Your Area of Interest</h2>
</cfif>
<cfoutput><p>Thank you for choosing the #session.schoolname#.<cfif session.schoolcode eq "business"> <strong>Please note that all applications to the Carey Business School should be submitted via the Web using the online application. Paper applications are no longer accepted.</strong></cfif> The information and steps that follow should help you easily navigate the online admissions process. If you have additional questions, please don't hesitate to contact us at #session.appphonenumber# or email <a href="mailto:#session.appe mail#">#se ssion.appe mail#</a>. </cfoutput >
<!--- if school is PSL, set the URL param f to n, which waives the application fee--->
<cfoutput>
<cfif session.schoolcode eq "psl">
<form action="" method="post" enctype="multipart/form-da ta" name="category">
<cfelse>
<form action="" method="post" enctype="multipart/form-da ta" name="category" onsubmit="SetFields(docume nt.categor y.programl ist,docume nt.categor y.FieldsSa ve);">
</cfif>
<input type="hidden" Name="FieldsSave">
<input type="hidden" value="#session.schoolcode #" name="form.school">
</cfoutput>
<cfif session.schoolcode eq "psl">
<cfoutput query="request.programlist " >
<h2>#category#</h2>
<label for="programlist" title="Area of interest"></label>
<select id="programlist" name="degree" multiple="true" size="#cnt#">
<cfoutput>
<option value="#id#">#webname#</op tion>
</cfoutput>
</select>
</cfoutput>
<cfelse>
<h2>Select an area of interest from the list below:</h2>
<select id="programlist" size="15">
<cfoutput query="request.programlist " group="category">
<option value="#categoryid#">#cate gory#</opt ion>
</cfoutput>
</select>
</cfif>
<div id="upDown">
<input type="button" id="moveUp" name="moveUp" value="MoveUp" onclick="javascript:Field_ up(documen t.category .programli st);"/>
<input type="button" id="moveDown" name="moveDown" value="moveDown" onclick="javascript:Field_ down(docum ent.catego ry.program list);"/>
</div>
<cfif session.schoolcode eq "psl">
<p> <input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Select"></p>
<cfelseif session.schoolcode eq "educaton">
<p><em>Inquiries about doctoral programs in education should be directed to the Department of Teacher Development and Leadership at 410-516-9755 or the Department of Special Education at 410-516-8275.</em></p>
</cfif>
<input type="submit" value="Submit" name="btnsubmit" id="btnsubmit2">
</form>
<cfparam name="form.FieldsSave" default="">
<cfif isDefined("btnsubmit")>
<cfset Order=1>
<cfloop list="#Form.FieldsSave#" index="field">
<cfquery name="SetOrder" datasource="HotBanana_Mana ger">
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo lcode#'
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
</div>
</div>
<div class="TabbedPanelsContent ">Content 3</div>
</div>
<cfdump var="#form#">
<cfdump var="#Form.FieldsSave#">
<cfoutput>
<script language="JavaScript" type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels(" TabbedPane ls1", { defaultTab: 0});
</script>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<!---Get Front End function--->
<cffunction name="getFrontEnd">
<cfset var output = StructNew()>
<cfset output.title ="">
<cfset output.blnHideContent = false>
<cfparam name="URL.degree" default="">
<cfparam name="URL.step" default="1">
<cfparam name="url.school" default="">
<cfset stepCardinality=Left("#URL .step#", 1)>
<cfsavecontent variable="output.body">
<cfoutput>
<cfset session.schoolcode=#url.sc hool#>
#mainMenu(url.step)# </cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
</cfcomponent>
<cfcomponent displayname="newPsa" extends="hb50.tool">
<cffunction name="mainMenu" >
<cfargument name="stepId" required="yes" type="string">
<cfsavecontent variable="output">
<cfoutput>
<cfif stepId eq "1">
<cfoutput>
#school()# </cfoutput>
</cfif>
<cfif ((stepId eq "business") or (stepId eq "education") or (stepId eq "psl")) >
<cfoutput>
#GenerateAdmissionsWizardT
</cfif>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="school" >
<cfsavecontent variable="output">
<cfquery name="school" datasource="HotBanana_Mana
select distinct school_division from trnAcademicPrograms
</cfquery>
<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="JavaScript" type="text/javascript">
function validateForm(objForm){
var strErr='';
if(!objForm.school.options
strErr='Invalid Selection!\nUnable to submit form.\nPlease make a valid selection and try again.'
}
if(strErr){
alert(strErr);
}else{
objForm.action='?debug&ste
}
return !strErr;
}
</script>
<cfparam name="form.school" default="">
<cfparam name="form.session" default="">
<cfset session.schoolcode=form.sc
<cfoutput>session:#session
<div id="menuOption">
<h2 style="margin:20px;">Pleas
<form action="" method="post" enctype="multipart/form-da
<select name="school" id="school">
<option>[Please select a school]</option>
<cfloop query="school"><option value="#school_division#">
</select>
<input type="submit" value="Select School" id="btnsubmit" >
</form>
</div>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<cffunction name="GenerateAdmissionsWi
<cfargument name="stepId" required="yes" type="string">
<cfargument name="degree" required="yes" type="string">
<cfsavecontent variable="output">
<link href="/spry/widgets/tabbed
<script type="text/javascript" src="/spry/widgets/tabbedp
<script type="text/javascript">
function Field_up(lst) {
var i = lst.selectedIndex;
if (i>0) Field_swap(lst,i,i-1);
}
function Field_down(lst) {
var i = lst.selectedIndex;
if (i<lst.length-1) Field_swap(lst,i+1,i);
}
function Field_swap(lst,i,j) {
var t = '';
t = lst.options[i].text; lst.options[i].text = lst.options[j].text; lst.options[j].text = t;
t = lst.options[i].value; lst.options[i].value = lst.options[j].value; lst.options[j].value = t;
t = lst.options[i].selected; lst.options[i].selected = lst.options[j].selected; lst.options[j].selected = t;
t = lst.options[i].defaultSele
}
function SetFields(lst,lstSave) {
var t;
lstSave.value=""
for (t=0;t<=lst.length-1;t++)
lstSave.value+=String(lst.
if (lstSave.value.length>0)
lstSave.value=lstSave.valu
}
</script>
<cfparam name="form.school" default="">
<cfset session.schoolcode=form.sc
<!---<cfparam name="form.school" default="">--->
<input type="hidden" value="#session.schoolcode
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGrou
<li class="TabbedPanelsTab" tabindex="0" >Category</li>
<li class="TabbedPanelsTab" tabindex="0" >SubCategory</li>
</ul>
<div class="TabbedPanelsContent
<div class="TabbedPanelsContent
<div class="TabbedPanelsContent
<cfstoredproc procedure="spWebProgramLis
<cfprocparam type="in" cfsqltype="cf_sql_varchar"
<cfprocresult name="request.programlist"
</cfstoredproc>
<cfif session.schoolcode eq "psl">
<h2>Step 1: Select Your Program</h2>
<cfelse>
<h2>Step 1: Select Your Area of Interest</h2>
</cfif>
<cfoutput><p>Thank you for choosing the #session.schoolname#.<cfif
<!--- if school is PSL, set the URL param f to n, which waives the application fee--->
<cfoutput>
<cfif session.schoolcode eq "psl">
<form action="" method="post" enctype="multipart/form-da
<cfelse>
<form action="" method="post" enctype="multipart/form-da
</cfif>
<input type="hidden" Name="FieldsSave">
<input type="hidden" value="#session.schoolcode
</cfoutput>
<cfif session.schoolcode eq "psl">
<cfoutput query="request.programlist
<h2>#category#</h2>
<label for="programlist" title="Area of interest"></label>
<select id="programlist" name="degree" multiple="true" size="#cnt#">
<cfoutput>
<option value="#id#">#webname#</op
</cfoutput>
</select>
</cfoutput>
<cfelse>
<h2>Select an area of interest from the list below:</h2>
<select id="programlist" size="15">
<cfoutput query="request.programlist
<option value="#categoryid#">#cate
</cfoutput>
</select>
</cfif>
<div id="upDown">
<input type="button" id="moveUp" name="moveUp" value="MoveUp" onclick="javascript:Field_
<input type="button" id="moveDown" name="moveDown" value="moveDown" onclick="javascript:Field_
</div>
<cfif session.schoolcode eq "psl">
<p> <input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Select"></p>
<cfelseif session.schoolcode eq "educaton">
<p><em>Inquiries about doctoral programs in education should be directed to the Department of Teacher Development and Leadership at 410-516-9755 or the Department of Special Education at 410-516-8275.</em></p>
</cfif>
<input type="submit" value="Submit" name="btnsubmit" id="btnsubmit2">
</form>
<cfparam name="form.FieldsSave" default="">
<cfif isDefined("btnsubmit")>
<cfset Order=1>
<cfloop list="#Form.FieldsSave#" index="field">
<cfquery name="SetOrder" datasource="HotBanana_Mana
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoo
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
</div>
</div>
<div class="TabbedPanelsContent
</div>
<cfdump var="#form#">
<cfdump var="#Form.FieldsSave#">
<cfoutput>
<script language="JavaScript" type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("
</script>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
<!---Get Front End function--->
<cffunction name="getFrontEnd">
<cfset var output = StructNew()>
<cfset output.title ="">
<cfset output.blnHideContent = false>
<cfparam name="URL.degree" default="">
<cfparam name="URL.step" default="1">
<cfparam name="url.school" default="">
<cfset stepCardinality=Left("#URL
<cfsavecontent variable="output.body">
<cfoutput>
<cfset session.schoolcode=#url.sc
#mainMenu(url.step)# </cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
</cfcomponent>
ASKER
OK I got it to work, but how can I see the changes as soon as the submit button button is pressed
>>I added the hidden field to the second form but still the query does ncot receive the schoolcode
you named it form.school, it's supposed to be 'school'
you named it form.school, it's supposed to be 'school'
ASKER
OK I got it to work, but how can I see the changes as soon as the submit button button is pressed
>>OK I got it to work, but how can I see the changes as soon as the submit button button is pressed
not sure what you are asking here
to see teh cahnges you would neeed to refresh teh page
not sure what you are asking here
to see teh cahnges you would neeed to refresh teh page
ASKER
how can I avoid refreshing the page
if you do not want to refresh teh page, you will need to use AJAX or a popup window to sho the changes
ASKER
tell me how can i use the ajax to support that
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MY system is setum so where can we begin
thats out of scope fro this question and my knowledge...
you need to have a processing page that can be called to return the values you need to update, any page will do, i plain cf page with a query and a return value
<cfquery name="getDesc">
SELECT SCHOOL_NAME
FROM TABLE
WHERE ....
</cfquery>
<cfoutput>#getDesc.school_ name#</cfo utput>
you need to make a call to teh page and return the value
see here for more
http://www.w3schools.com/ajax/default.asp
you need to have a processing page that can be called to return the values you need to update, any page will do, i plain cf page with a query and a return value
<cfquery name="getDesc">
SELECT SCHOOL_NAME
FROM TABLE
WHERE ....
</cfquery>
<cfoutput>#getDesc.school_
you need to make a call to teh page and return the value
see here for more
http://www.w3schools.com/ajax/default.asp
we need to see the full page code tehn, the problem isn't teh query, something else is goiing on where the session var is reset or deleted
please post the screen where the session var is set(first page) anmd teh second page code.