I have two problems that I suspect will be bread-and-butter problems for the
more experienced guys on here, but I'm not the greatest with js.
NB: Code snippets at the bottom
The first problem is that after a bit of fiddling I'm getting am 'Object
Expected' error when I click on the Depot dropdown which I can't seem to get
round. The code I had was working OK but then I cut it all out, tidied it
all up, and put it back in and now it doesnt work.
The second problem is a 'How do I...'. I'm using an XML data island to
retrieve some data without submitting the form. In the first example, when
the user selects a Customer, the Depot list is updated with all the depots
for that customer; This all works fine. What I want to do now is retrieve
some more data when the Depot is selected.
I have the XML bits working; the js code snippet correctly output a series
of msgboxes with the correct value in (or at least it did until I introduced
the Object Expect error!).
However, I'm unsure as to how to display this information on the page. The
XML contains a series of Part No's and Quantities, which I'd like to display
in a table towards the bottom of the screen. The problem is that I don't
know how to dynamically create and populate this table.
The only caveat is that I dont want to show the table if no values are
returned from the query.
Any suggestions?
Thanks in advance...
Chris
CODE SNIPPETS
checkowned.js:
function checkCustOwned(DepotID) {
var currNode;
alter('start');
XMLID.async = false;
// Change Ddata Island source
strQuery = "Exec Orders_CheckForCustOwned " + DepotID;
XMLID.SRC="/fxdb/common/xmlQuery.asp?strQuery=" + strQuery;
// Get all "names" from XML data
objPartNos = XMLID.getElementsByTagName("PartNo");
objNumFilters= XMLID.getElementsByTagName("NumFilters");
if objPartNos.length > 0
{
for (var i=0; i < objPartNos.length; i++) {
alert(objPartNos.item(i).text);
alert(objNumFilters.item(i).text);
}
}
}
neworder.asp:
<!-- #include virtual="/fxdb/common/dates.asp" -->
<!-- #include virtual="/fxdb/common/FilterSQL.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>FXDB: Create New Order</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="/fxdb/FXDB.css">
<script type="text/javascript" src="/fxdb/menu.js"></script>
<script language="javascript" src="/fxdb/common/validation.js"></script>
<script language="javascript" src="/fxdb/common/checkowned.js"></script>
<script language="javascript" src="/fxdb/common/custlist.js"></script>
<script language="JavaScript" src="/fxdb/common/calendar1.js"></script>
</head>
<body>
<!-- Data Island-->
<XML ID="XMLID"></XML>
<div id="content">
<h1>Filter Exchange Database</h1>
<h2>Maintain Orders</h2>
<h4>Create New Order:</h4>
..
..
[snipped for clarity]
..
..
<form method="post" id="fProcess" name="fProcess" action="neworder.asp">
<table class="form">
<col class="field">
<col class="value">
<tbody>
<tr>
<td>Customer:</td>
<td>
<select id="CustomerID" NAME="CustomerID"
onfocus="javascript:populateCombo(fProcess.Custome rID.value)"
onChange="javascript:populateCombo(fProcess.Custom erID.value)"
selcontrol="true" mandatory="true" alt="Customer">
<!-- #include virtual="/fxdb/common/custlist.asp" -->
</select>
</td>
</tr>
<tr>
<td>Depot:</td>
<td>
<select name="depot" id="depot" size="1" selcontrol="true"
mandatory="true" alt="Depot"
onchange="javascript:checkCustOwned(fProcess.depot .value)">
<option value="" selected ><Select Depot></option>
</select>
</td>
</tr>
<tr>
..
..
[snipped for clarity]
..
..
</html>
--
cj*******@REMOVEMEyahoo.co.uk
[remove the obvious bits]