1.1 --- a/examples/Common/Configurator/Resources/scripts/XSLForms.js Sat May 07 00:45:09 2005 +0000
1.2 +++ b/examples/Common/Configurator/Resources/scripts/XSLForms.js Sun May 08 21:05:24 2005 +0000
1.3 @@ -1,7 +1,13 @@
1.4 function requestUpdate(url, fieldName, targetName, targetFieldName) {
1.5 var xmlhttp = Sarissa.getXmlHttpRequest();
1.6 xmlhttp.open("POST", url, false);
1.7 +
1.8 + // Find the value of the controlling field.
1.9 +
1.10 var fieldValue = document.getElementsByName(fieldName)[0].value;
1.11 +
1.12 + // Find the value of the target field, along with the node where the target field is defined.
1.13 +
1.14 var targetFieldValue;
1.15 var targetFieldNodes = document.getElementsByName(targetFieldName);
1.16 if (targetFieldNodes.length != 0) {
1.17 @@ -9,17 +15,22 @@
1.18 } else {
1.19 targetFieldValue = "";
1.20 }
1.21 - //alert(fieldValue);
1.22 +
1.23 + // Load the remote document with the given parameters sent as text in the request body.
1.24 +
1.25 xmlhttp.send(fieldName + "=" + fieldValue + "\r\ntarget-field-name=" + targetFieldName + "\r\n" + targetFieldName + "=" + targetFieldValue);
1.26 - //alert(xmlhttp.status);
1.27 - //alert(xmlhttp.responseText);
1.28 +
1.29 + // Parse the result document.
1.30 +
1.31 var newDocument = Sarissa.getDomDocument();
1.32 newDocument.loadXML(xmlhttp.responseText);
1.33 - //alert(newDocument);
1.34 +
1.35 + // Find the definition of the affected field in the result document.
1.36 +
1.37 var newElement = newDocument.getElementById(targetName);
1.38 var targetElement = document.getElementById(targetName);
1.39 - //alert(newElement);
1.40 - //alert(targetElement);
1.41 +
1.42 + // Insert the new definition into the current document.
1.43
1.44 if (newElement != null && targetElement != null) {
1.45 var importedElement = document.importNode(newElement, true);