1.1 --- a/examples/Common/Configurator/Resources/scripts/XSLForms.js Thu Jul 21 18:49:50 2005 +0000
1.2 +++ b/examples/Common/Configurator/Resources/scripts/XSLForms.js Thu Jul 21 18:50:24 2005 +0000
1.3 @@ -1,4 +1,4 @@
1.4 -function requestUpdate(url, fieldName, targetName, targetFieldNames, elementPath) {
1.5 +function requestUpdate(url, fieldNames, targetName, targetFieldNames, elementPath) {
1.6
1.7 // If no field names exist as targets for the update, do not attempt to
1.8 // update them.
1.9 @@ -13,40 +13,14 @@
1.10 var xmlhttp = new XMLHttpRequest();
1.11 xmlhttp.open("POST", url, false);
1.12
1.13 - // Find the value of the controlling field.
1.14 + // Add the element path specification.
1.15
1.16 - var fieldValue = document.getElementsByName(fieldName)[0].value;
1.17 + var requestBody = ("element-path=" + elementPath);
1.18
1.19 // Send the controlling field value.
1.20
1.21 - var requestBody = (fieldName + "=" + fieldValue);
1.22 -
1.23 - // Process each target field name.
1.24 -
1.25 - var targetFieldNameArray = targetFieldNames.split(",");
1.26 -
1.27 - // Add the values of the dependent fields.
1.28 -
1.29 - for (var i = 0; i < targetFieldNameArray.length; i++) {
1.30 - var targetFieldName = targetFieldNameArray[i];
1.31 -
1.32 - // Find the values of the target field.
1.33 -
1.34 - var targetFieldValue;
1.35 - var targetFieldNodes = document.getElementsByName(targetFieldName);
1.36 - for (var v = 0; v < targetFieldNodes.length; v++) {
1.37 - targetFieldValue = targetFieldNodes[v].value;
1.38 - requestBody += ("\r\n" + targetFieldName + "=" + targetFieldValue);
1.39 - }
1.40 -
1.41 - // NOTE: Konqueror hack: disable fields.
1.42 -
1.43 - disableFields(targetFieldName);
1.44 - }
1.45 -
1.46 - // Add the element path specification.
1.47 -
1.48 - requestBody += ("\r\nelement-path=" + elementPath);
1.49 + requestBody += addFields(fieldNames, false);
1.50 + requestBody += addFields(targetFieldNames, true);
1.51
1.52 // Load the remote document with the given parameters sent as text in the request body.
1.53
1.54 @@ -75,6 +49,38 @@
1.55 //showMismatch(targetFieldNameArray);
1.56 }
1.57
1.58 +function addFields(fieldNames, disable) {
1.59 +
1.60 + var requestBody = "";
1.61 +
1.62 + // Process each target field name.
1.63 +
1.64 + var fieldNameArray = fieldNames.split(",");
1.65 +
1.66 + // Add the values of the dependent fields.
1.67 +
1.68 + for (var i = 0; i < fieldNameArray.length; i++) {
1.69 + var fieldName = fieldNameArray[i];
1.70 +
1.71 + // Find the values of the target field.
1.72 +
1.73 + var fieldValue;
1.74 + var fieldNodes = document.getElementsByName(fieldName);
1.75 + for (var v = 0; v < fieldNodes.length; v++) {
1.76 + fieldValue = fieldNodes[v].value;
1.77 + requestBody += ("\r\n" + fieldName + "=" + fieldValue);
1.78 + }
1.79 +
1.80 + // NOTE: Konqueror hack: disable fields.
1.81 +
1.82 + if (disable) {
1.83 + disableFields(fieldName);
1.84 + }
1.85 + }
1.86 +
1.87 + return requestBody;
1.88 +}
1.89 +
1.90 function disableFields(targetFieldName) {
1.91
1.92 for (var i = 0; i < document.forms.length; i++) {