I have CF component which supposed to populate the requirements and of
thwe selected program. I wrote the code but there is something wrong
<cffunction name="updateProgramRequirements">
<cfparam name="form.program" default="">
<cfquery name="programs" datasource="HotBanana_Manager">
SELECT id, fullname+' '+programoption as webname,
fee,category,c.categoryid, ap.programnote, sc.subcategory
FROM dbo.trnAcademicProgramsAndCategoryMapping ac INNER
JOIN
dbo.trnAcademicProgramCategory c ON
ac.CategoryID = c.CategoryID INNER JOIN
dbo.trnAcademicPrograms ap ON ac.ProgramID =
ap.id LEFT OUTER JOIN
dbo.trnAcademicProgramSubCategory sc ON
ac.SubCategoryID = sc.SubCategoryID
order by id
</cfquery>
<cfquery name="infoNote" datasource="HotBanana_Manager" >
SELECT apr.reqid, apr.requirement,
aprm.degreeid,aprm.sortorder,apr.req_prereq,apr.hidden
FROM trnAcademicProgramsAndRequirementsMapping aprm INNER JOIN
trnAcademicProgramRequirements apr ON aprm.reqid =
apr.reqid INNER JOIN
trnAcademicPrograms ap ON aprm.degreeid = ap.id
<!---WHERE ap.id in (cast(form.program as int))--->
order by apr.req_prereq,id,aprm.sortorder
</cfquery>
<cfquery name="requirement" datasource="HotBanana_Manager">
select reqid, requirement from trnAcademicProgramRequirements
</cfquery>
<link href="/spry/widgets/selectvalidation/SpryValidationSelect.css"
rel="stylesheet" type="text/css" />
<script src="/spry/widgets/selectvalidation/
SpryValidationSelect.js" type="text/javascript"></script>
<script src="/spry/widgets/textareavalidation/
SpryValidationTextarea.js" type="text/javascript"></script>
<link href="/spry/widgets/textareavalidation/
SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='/ajax/core/
engine.js'></script>
<script type='text/javascript' src='/ajax/core/
util.js'></script>
<script type='text/javascript' src='/ajax/core/
settings.js'></script>
<script src="/spry/includes/SpryEffects.js" type="text/
javascript"></script>
<script type="text/javascript" src="javascripts/
prototype.lite.js"></script>
<script type="text/javascript" src="javascripts/
moo.fx.js"></script>
<script type="text/javascript" src="javascripts/
moo.fx.pack.js"></script>
<script language="javascript">
<!---function doQueryAndJS() {
// send data to CF
//DWRUtil.useLoadingMessage();
var program = DWRUtil.getValue("program");
//alert (program);
DWREngine._execute(_cfscriptLocation, null,
'requirements', program, doQueryAndJSResults);
}
function doQueryAndJSResults (r) {
eval(r);
}
--->
function handleDropdown(obj,show){
//document.getElementBuId
('moreschools2').value==true;
var ccHeight = new fx.Height('addReq', {duration:
500});
if (show) {
ccHeight.toggle();
} else {
ccHeight.hide();
}
}
window.onload = function() {
var ccHeight;
ccHeight = new fx.Height('addReq',
{duration: 500});
ccHeight.hide();
}
var arRequirements= new Array;
<cfoutput query="infoNote">
var oRequirement= new Object;
oRequirement.reqid=#infoNote.reqid#;
oRequirement.degreeid=#infoNote.degreeid#;
oRequirement.requirement="#JSStringFormat(infoNote.requirement)#";
arRequirements[arRequirements.lenght]=oRequirement;
</cfoutput>
<!---this function fills the second select box--->
function fillRequirements () {
with (document.forms[0].program) {
var degreeid=options[selectedIndex].value;
}
if (degreeid==null) {
return;
}
//remove all options from second selected box
document.combo_box.requirements.options.lenght=0;
//for each item in the requirements array
for (var i=0; i < arRequirements.lenght; i++) {
if (arRequirements[i].degreeid=degreeid) {
var objOption= new Option
(arRequirements[i].requirement,arRequirements[i].reqid);
//place new option in the new select box
with (document.forms[0].requirements) {
options[options.lenght]=objOption;
}
}
};
};
</script>
<cfsavecontent variable="output">
<div id="updateProgramRequirements">
<cfoutput> <form action="" method="post" enctype="multipart/form-
data" name="combo_box"></cfoutput>
<h2 style="margin:20px;">Update Program Requirements:</h2>
<!--- <div id="program">--->
<label for="program">Program:</label>
<cfoutput> <select id="program" name="program" multiple="false"
size="10" onchange="fillRequirements();" > </cfoutput>
<option>Please select program</option>
<cfoutput query="programs" >
<option value="#id#">#id#--#webname#</option>
</cfoutput>
</select>
<!---<span class="selectRequiredMsg">Please
select a program.</span>--->
<label id="label" for="req">Requirements:</label>
<!---<div id="req" name="req" style="margin:10px;"></div>--->
<select name="requirements" size="20">
<option>[choose a program first]</option>
</select>
<!---All requirements--->
<label for="requirement">All Requirement:</label>
<span class="requirement11"> <select id="requirement"
name="requirement" size="8" style="width:500px;"></span>
<option>Please select requirement</option>
<cfoutput query="requirement" >
<option title="#requirement.requirement#"
value="#requirement.reqid#">#requirement.requirement#</option>
</cfoutput>
</select>
<span id="checkreq2" name="checkreq2"></span>
<label id="label" for="prereq">Prereq:</label>
<div id="prereq" name="prereq"></div><br />
<label id="label" for="addreq2">[Add requirements]</label>
<label for="addreq2">Yes</label>
<input name="addreq2" type="radio" id="addreq2"
value="yes" onclick="handleDropdown(this,true)"/>
<label for="MoreSchools1">No</label>
<input name="addreq2" type="radio" id="addreq3" value="no"
checked="checked" onclick="handleDropdown(this,false)" />
<!---add requirements--->
<div id="addReq">
<cfoutput query="requirement">
<fieldset>
<legend>add requirement to the program</legend>
<input type="checkbox" id="checkReq" name="checkReq"
value="#requirement.reqid#"/><i> #requirement.requirement# </i><br />
</fieldset>
</cfoutput>
<input type="submit" name="addsubmit" value="Add requirements">
</div>
<!---<span class="textareaRequiredMsg">Please enter a program
requirement. </span>--->
<div id="addSubLoc" style="margin:20px;">
<input type="submit" name="btnsubmit"
value="Update Program Requirements">
<a href="psainsert2/"><img src="images/
previous_step_btn.gif" alt="BACK TO THE MAIN MENU" border="0"></a>
</div>
<cfif isDefined("addsubmit")>
<cfif isDefined("form.checkreq")>
<cfloop index="variables.i" from="1"
to="#ListLen(form.checkReq)#">
<cfset variables.thisCheckbox =
ListGetAt(form.checkReq,variables.i)>
<cftry>
<cfstoredproc procedure="addProgramReqforUpdate"
datasource="HotBanana_Manager" >
<cfprocparam type="in"
cfsqltype="cf_sql_integer" value="#variables.thisCheckbox#">
<cfprocparam type="in"
cfsqltype="cf_sql_integer" value="#form.program#">
</cfstoredproc>
<cfcatch type="database">
<p style=" color:##990000">Some of the selections are
already exist please pick different option</p>
</cfcatch>
</cftry>
</cfloop>
</cfif>
</cfif>
</form>
</div>
<cfoutput>
<script type="text/javascript">
var sel = new Spry.Widget.ValidationSelect("program", {validateOn:
["blur","change"]});
//var second_example= new Spry.Effect.Highlight('req', {toggle:false,
from:"##CCCCCC", to:"##CCFFCC",duration:1000});
//var area= new Spry.Widget.ValidationTextarea ("req", {validateOn:
["change","blur"]});
</script>
</cfoutput>
</cfsavecontent>
<cfreturn output>
</cffunction>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---