CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Problem with JScript

Print topic Send  topic

Author Message
Arthur Dent
Posted: 02/22/2006, 8:59 AM

Hi!,

Cause I'm new with Jscript, I need help.

I have following code on my page.


//Set one Konponenti name
function setKomponenti(parentObject, SiilonoNum) {

var sel_index = parentObject.options[parentObject.selectedIndex].value;

if (sel_index == "") {
var KomponenttiName = "";
var KomponenttiKoodi = "";
} else {
var KomponenttiKoodi = Komponentti[sel_index][0];
var KomponenttiName = Komponentti[sel_index][1];
}

document.getElementById("komponenttinimi"+SiilonoNum).innerHTML = KomponenttiName;

//Set code to the Aine field
document.getElementsByName("aine"+SiilonoNum)[0].value = KomponenttiKoodi;
}


function setKomponentiOnLoad() {
//Get all listboxed
var select_list = document.getElementsByTagName("select");

for (i = 0; i < select_list.length; i++) {
//Cut "siilono" from the name to get the digit
if (select_list.name.substring(0,7) == "siilono") {
var sell_num = select_list.name.substring(7);
setKomponenti(select_list, sell_num);
}
}
}


//Set the KomponenttiName in the edit mode
window.onload = function() {
setKomponentiOnLoad();
}


<!-- BEGIN Grid ForJScript -->
var Komponentti = new Array();
<!-- BEGIN Row -->
Komponentti["{SiiloNum}"] = new Array("{komponenttikoodi}","{komponenttinimi}");
<!-- END Row -->
<!-- END Grid ForJScript -->



I'll get error from program at this point:
var KomponenttiKoodi = Komponentti[sel_index][0];

Error is that 'Komponentti[...].0' is null or not an object.

This error comes when the selected list box get values 11-> but not between 0-10.

What could be wrong?

AD

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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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