myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mstar...@apache.org
Subject svn commit: r1438160 - /myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
Date Thu, 24 Jan 2013 20:22:37 GMT
Author: mstarets
Date: Thu Jan 24 20:22:37 2013
New Revision: 1438160

URL: http://svn.apache.org/viewvc?rev=1438160&view=rev
Log:
TRINIDAD-2216 - The partialSubmit does not work with JSF 2 RI

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js?rev=1438160&r1=1438159&r2=1438160&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
Thu Jan 24 20:22:37 2013
@@ -306,6 +306,26 @@ TrXMLJsfAjaxRequest.prototype.send = fun
 {
   var source = this._params.source ?
     _getElementById(window.document, this._params.source) : null;
+    
+  var formElement = (this._formId != null) ? document.getElementById(this._formId) : null;
+  
+  // TRINIDAD-2216 - Deal with source elements that do not have Id set
+  if (source == null)
+  {
+    var evt = this._event;
+    if (evt)
+    {
+      source = evt.target || evt.srcElement;
+      if (source)
+      {
+        source.id = this._params.source;
+      }
+    }
+    else if (this._params.rtrn) // this is a dialog event
+    {
+      source = formElement;
+    }
+  }
 
   var ajaxCallback = TrUIUtils.createCallback(this, this._ajaxCallback);
 
@@ -326,29 +346,26 @@ TrXMLJsfAjaxRequest.prototype.send = fun
   // need to update the form here and remove the values from the params.
   this._origFormValues = {};
   this._formElements = {};
-  if (this._formId != null)
+  
+  if (formElement != null)
   {
-    var formElement = document.getElementById(this._formId);
-    if (formElement != null)
+    var formElements = formElement.elements;
+    for (var i = 0; i < formElements.length; ++i)
     {
-      var formElements = formElement.elements;
-      for (var i = 0; i < formElements.length; ++i)
+      var input = formElements[i];
+      if (input.name && !input.disabled && !(input.tagName == "INPUT" &&
input.type == "submit"))
       {
-        var input = formElements[i];
-        if (input.name && !input.disabled && !(input.tagName == "INPUT" &&
input.type == "submit"))
+        for (p in payload)
         {
-          for (p in payload)
+          if (p == input.name)
           {
-            if (p == input.name)
-            {
-              var payloadValue = payload[p];
-              delete payload[p];
-
-              this._origFormValues[p] = input.value;
-              this._formElements[p] = input;
-              input.value = payloadValue;
-              break;
-            }
+            var payloadValue = payload[p];
+            delete payload[p];
+
+            this._origFormValues[p] = input.value;
+            this._formElements[p] = input;
+            input.value = payloadValue;
+            break;
           }
         }
       }



Mime
View raw message