actually the "section" combo box will inherit another value combo box value name "office": here I attach the code for analysis.
<h2>Add New User</h2>
<br />
<!---Initialize--->
<cfparam name="dept" default="0">
<cfparam name="form.office" default="">
<cfquery name="qDepartment" datasource="#Variables.fw.Config.DSN#">
SELECT * FROM DEPARTMENT_U
ORDER BY dept_name_eng asc
</cfquery>
<script>
function validate(){
if (document.getElementById('department').value == "") { alert('Section cannot be empty!') ; return false;}
}
function abc(){
var iID = document.getElementById("department").value
var randStr = randomString();
document.getElementById('abc').innerHTML="<img src='themes/default/img/wait20trans.gif'>";
ajaxpage('index.cfm?section=users&action=list&SGrp='+ iID +'&str=BE'+ randStr, 'abc');
}
</script>
<form action="index.cfm?section=users" method="POST" enctype="multipart/form-data">
<input type="hidden" name="section" value="users">
<input type="hidden" name="action" value="add">
<table width="100%" class="news_frame" cellspacing="2" cellpadding="5">
<tr>
<td align="center" class="news_title">
<table class="form">
<tr>
<td>Section</td>
<td>:</td>
<td>
<cfoutput>
<select name="department" id="department" onchange="abc()">
<option value="" >-- Choose One --</option>
<cfloop query="qDepartment">
<option value="#qDepartment.dept_id#" <cfif qDepartment.dept_id EQ dept>selected</cfif>>#qDepartment.dept_name_eng#
| #qDepartment.dept_name_mal#</option>
</cfloop>
</select>
</cfoutput>
</td>
</tr>
<tr>
<td>Office</td>
<td>:</td>
<td>
<div id="abc">
<cfoutput>
<select name="office" id="office">
<option value="" >None</option>
</select>
</cfoutput>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
The code for file "user_add.cfm"The other related code named "list.cfm", here I attach with:
<cfif isdefined("url.Sid")>
: <select name="apps" id="apps">
<cfquery name="qApps" datasource="#Application.fw.Config.DSN#">
Select * from apps where sys_name='#url.Sid#' order by app_name asc
</cfquery>
<cfoutput query="qApps">
<option value="#qApps.app_id#">#qApps.app_name#</option>
</cfoutput>
</select>
</cfif>
<cfif isdefined("url.SGrp")>
<select name="office" id="office">
<option value="" >-- Choose One --</option>
<cfquery name="qOffice" datasource="#Application.fw.Config.DSN#">
Select distinct(brgrp_office) as office_id from deptgrp where brgrp_deptid='#url.SGrp#'
</cfquery>
<cfoutput query="qOffice">
<option value="#qOffice.office_id#">
<cfif
#qOffice.office_id# EQ "" or #qOffice.office_id# EQ 0>None
<cfelse>
#fw_Check_table(qOffice.office_id,"office_id","office","office_name")#
</cfif>
</option>
</cfoutput>
</select>
</cfif>
<cfif isdefined("url.mID")>
<select name="unit" id="unit">
<option value="" >-- Choose One --</option>
<cfquery name="qUnit" datasource="#Application.fw.Config.DSN#">
Select distinct(brgrp_brid) as brgrp_brid from deptgrp where brgrp_deptid='#url.mID#'
</cfquery>
<cfoutput query="qUnit">
<option value="#qUnit.brgrp_brid#"><cfif #qUnit.brgrp_brid# EQ "" or #qUnit.brgrp_brid# EQ 0>None<cfelse>#fw_Check_table(qUnit.brgrp_brid,"br_id","unit","br_name")#</cfif></option>
</cfoutput>
</select>
</cfif><cfif isdefined("url.Sid")>
: <select name="apps" id="apps">
<cfquery name="qApps" datasource="#Application.fw.Config.DSN#">
Select * from apps where sys_name='#url.Sid#' order by app_name asc
</cfquery>
<cfoutput query="qApps">
<option value="#qApps.app_id#">#qApps.app_name#</option>
</cfoutput>
</select>
</cfif>
<cfif isdefined("url.SGrp")>
<select name="office" id="office">
<option value="" >-- Choose One --</option>
<cfquery name="qOffice" datasource="#Application.fw.Config.DSN#">
Select distinct(brgrp_office) as office_id from deptgrp where brgrp_deptid='#url.SGrp#'
</cfquery>
<cfoutput query="qOffice">
<option value="#qOffice.office_id#">
<cfif
#qOffice.office_id# EQ "" or #qOffice.office_id# EQ 0>None
<cfelse>
#fw_Check_table(qOffice.office_id,"office_id","office","office_name")#
</cfif>
</option>
</cfoutput>
</select>
</cfif>
<cfif isdefined("url.mID")>
<select name="unit" id="unit">
<option value="" >-- Choose One --</option>
<cfquery name="qUnit" datasource="#Application.fw.Config.DSN#">
Select distinct(brgrp_brid) as brgrp_brid from deptgrp where brgrp_deptid='#url.mID#'
</cfquery>
<cfoutput query="qUnit">
<option value="#qUnit.brgrp_brid#"><cfif #qUnit.brgrp_brid# EQ "" or #qUnit.brgrp_brid# EQ 0>None<cfelse>#fw_Check_table(qUnit.brgrp_brid,"br_id","unit","br_name")#</cfif></option>
</cfoutput>
</select>
</cfif>
please give me some idea to settle this matter.
Thanks

New Topic/Question
Reply



MultiQuote




|