CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dependent downdown box. help needed?

Print topic Send  topic

Author Message
Aidi
Posted: 08/25/2004, 8:57 AM

Hi,

I have implemented your dependent listbox drop down feature as show in your download. However when I try to do 2 or 3 levels of dependencies, the url will return an incorrect one. There will be a missing ? when I do the 2nd selection.

The additional code are as followed

Put this after the <title>
<script>
// Added by DNB, removes "parameter" from this page's window.location.href
// The item removed is something like "?parameter=value" (or it may start with "&")

function removeFromURL(URi, parameter) {
var regexp, path, params, qStart = URi.indexOf('?') + 1;
if (qStart == 0 || qStart == URi.length-1) return URi;
regexp = new RegExp("(" + parameter + "=[^&]+(&)?)");
return URi.substring(0,qStart-1) +
URi.substring(qStart).replace(regexp,'').replace(/&$/,'');
}
</script>


These are the 2 codes for the on change

//page_Record_ProductCategoryID_OnChange @25-93CEAB07
function page_Record_ProductCategoryID_OnChange()
{
var result;
//End page_Record_ProductCategoryID_OnChange

//Custom Code @32-2A29BDB7
// -------------------------
var strURL = removeFromURL(window.location.href,"ProductCategoryID");

if (strURL.indexOf("?") > 0) {
window.location.href = strURL + "&ProductCategoryID=" + this.value;
}
else {
window.location.href = strURL + "?ProductCategoryID=" + this.value;
}
// -------------------------
//End Custom Code

//Close page_Record_ProductCategoryID_OnChange @25-BC33A33A
return result;
}
//End Close page_Record_ProductCategoryID_OnChange

//page_Record_ProductModel_OnChange @26-9EC27DE4
function page_Record_ProductModel_OnChange()
{
var result;
//End page_Record_ProductModel_OnChange

//Custom Code @36-2A29BDB7
// -------------------------
var strURL = removeFromURL(window.location.href,"ProductModel");

if (strURL.indexOf("?") > 0) {
window.location.href = strURL + "&ProductModel=" + this.value;
}
else {
window.location.href = strURL + "?ProductModel=" + this.value;
}
// -------------------------
//End Custom Code

The onchange fot productcategory returns a correct URL of
http://localhost/ToshibaWarranty/Registration.asp?ProductCategoryID=4

The error occurs only when I do a selection on the ProductModel. It will return the following URL.
http://localhost/ToshibaWarranty/Registration.aspProduc...oductModel=DVD1

But I saw from the code that it is supposed to be appended with & instead of adding a $. Why this error occurs?
:-/

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.

Web Database

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.