CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> General/Other

 Another dependent dropdown question

Print topic Send  topic

Author Message
robn

Posts: 70
Posted: 11/25/2005, 5:20 AM

Right I know there are loads of topics on this but I have search through most of them and can't find the solution to my issue. i have build a dependent listbox based on some of the examples out there (mainly the one in the CCS example pack 2) which works perfectly apart from one thing. I can get the first list box to populate the second list box fine (based on the selection from the first list box). But the issue I have is that some of the fields in the second list box (in this case a status dropdown) should appear in all the selections from the first (Category) list box (i.e. some of the status fields are generic and cover all categories). I know I could get around this by creating the same status for all the categories. But what I would like to do is say show all Statuses associated with category X plus all statuses with a category value of 0.

My code so far looks like this

<script language="JavaScript">
var DomYes=document.getElementById?1:0;

function set_child_listbox(parentObject,childObject,childArray,spanToHide) {

//Clear child listbox
for(var i=childObject.length;i>0;i--) {
childObject.options = null;
}

childObject.options[0] = new Option("Select Value","");
var sel_index = parentObject.options[parentObject.selectedIndex].value;
if (sel_index == "") {
childObject.disabled = true;
} else {
childObject.disabled = false;
var childIndex = 1;
for (i = 0; i < childArray.length; i++) {
if (childArray[1] == sel_index) {
childObject.options[childIndex] = new Option(childArray[2], childArray[0]);
childIndex++;
}
}
}
//Select first option
childObject.selectedIndex = 0;


}

function reload_page() {
var sel_index = document.tblQualcall.s_Category_id.options[document.tblQualcall.s_Category_id.selectedIndex].value;
var sel_subindex = document.tblQualcall.s_status.options[document.tblQualcall.s_status.selectedIndex].value;
if (sel_subindex != "") {
document.location.href = document.location.pathname + "?" + "s_status=" + sel_subindex+"&s_Category_id=" + sel_index;
}
}

function disable_child_listbox(spanToHide) {

//Disable second listbox
if (document.tblQualcall.s_Category_id.selectedIndex == "") {
document.tblQualcall.s_status.disabled = true;
}

}

window.onload = function() {
disable_child_listbox("Products");
}

<!-- BEGIN Grid tblQualCategory_tblQualst -->
var Status = new Array(
<!-- BEGIN Row -->
new Array({tblStatus_Id},{tblStatus_CategoryLink},'{tblStatus_Status}')<!-- END Row --><!-- BEGIN Separator -->,<!-- END Separator -->
);
<!-- END Grid tblQualCategory_tblQualst -->
</script>

hope this makes sense any help would be much appriciated.

thanks

Rob
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.