Forum Moderators: open

Message Too Old, No Replies

sciprt undefined property

         

RogueDogg

11:33 pm on Jul 12, 2006 (gmt 0)

10+ Year Member



Can anyone tell me why the "productname" would be considered undefined (or has no properties) in this script please, if you need more code or understanding please ask and I'll fill in more of the details if needed. THANKS in advance:

<SCRIPT LANGUAGE="JavaScript">
function showDescription(sel, productdesc, price, productname){
var opt = sel.options;
if(opt[sel.selectedIndex].value == "productname"){
productname.value = "product name";
productdesc.value = "product description";
price.value = "product price";
}else{
productname.value = opt[sel.selectedIndex].text;
var ary = opt[sel.selectedIndex].value.split("¦");
productdesc.value = ary[0];
price.value = ary[1];
}
return true;
}
</script>

[edited by: RogueDogg at 11:34 pm (utc) on July 12, 2006]

kaled

11:54 pm on Jul 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How is the function being called? If you are passing html objects as parameters then I think it should work (but I haven't looked too closely) but if you are passing string values it will fail.

Kaled.

RogueDogg

12:27 am on Jul 13, 2006 (gmt 0)

10+ Year Member



I'm running a db query to come up with the values, then basically what's happening is this:

Productname is in a drop down menu -- select a product then it displays the productdesc in a textarea and also the price in a textbox. When I submit those to invoice.php and echo the values $productname, $productdesc, $price it's not displaying $productname ( productname has no properties according to FireFox console ) and it's displaying $productdesc ¦ $price -- $productdesc....so basically displaying the $productdesc twice. I can give you working solutions via PM if you like.

[edited by: RogueDogg at 12:28 am (utc) on July 13, 2006]

RogueDogg

4:02 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



Thanks for your help but I seemed to have figured it out with some help on another forum. I still have some tweaking left to do but for the most part it's fixed. Thanks again.