Author: wesleyhales
Date: 2009-03-06 19:08:27 -0500 (Fri, 06 Mar 2009)
New Revision: 12989
Modified:
branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/dyna.js
branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/prototype.js
Log:
JBPORTAL-2336
Modified: branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/dyna.js
===================================================================
--- branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/dyna.js 2009-03-06
23:23:03 UTC (rev 12988)
+++ branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/dyna.js 2009-03-07
00:08:27 UTC (rev 12989)
@@ -1,3 +1,5 @@
+var currentSubmit;
+
function sendData(action, windowId, fromPos, fromRegionId, toPos, toRegionId) {
var options = {
requestHeaders:
["ajax","true","bilto","toto"],
@@ -71,6 +73,12 @@
var source = Event.element(event);
var container = Element.up(source, "div.dyna-window");
+ //attach onclick observer to all submit buttons
+ $$('input[type=submit]').invoke('observe', 'click',
function(e) {
+ currentSubmit = this;
+ alert(this);
+ });
+
// We found the window
if (container != null) {
@@ -124,7 +132,7 @@
options.enctype = enctype;
options.asynchronous = false;
options.method = "post"
- options.postBody = Form.serialize(current);
+ options.postBody =
Form.serialize(current,'',currentSubmit);
}
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/prototype.js
===================================================================
---
branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/prototype.js 2009-03-06
23:23:03 UTC (rev 12988)
+++
branches/JBoss_Portal_Branch_2_6/theme/src/bin/portal-ajax-war/dyna/prototype.js 2009-03-07
00:08:27 UTC (rev 12989)
@@ -1838,7 +1838,9 @@
"FORM": Object.clone(Form.Methods),
"INPUT": Object.clone(Form.Element.Methods),
"SELECT": Object.clone(Form.Element.Methods),
- "TEXTAREA": Object.clone(Form.Element.Methods)
+ "TEXTAREA": Object.clone(Form.Element.Methods),
+ //[SERIALIZE_ERROR]
+ "BUTTON": Object.clone(Form.Element.Methods)
});
}
@@ -2641,8 +2643,21 @@
};
Form.Methods = {
- serialize: function(form, getHash) {
- return Form.serializeElements(Form.getElements(form), getHash);
+ serialize: function(form, options, buttonPressed) {
+ //[SERIALIZE_ERROR] Implements additional functionality to support <button> and
ensure other button-type
+ // <inputs> are not serialized
+ var elements = Form.getElements(form);
+ if (buttonPressed) {
+ elements = elements.findAll(
+ function(element) {
+ return element == $(buttonPressed) ||
+ (element.tagName.toLowerCase() != "button" &&
+ (element.tagName.toLowerCase() != "input" ||
+ (element.type != "submit" && element.type !=
"button" && element.type != "image" && element.type !=
"reset")));
+ }
+ );
+ };
+ return Form.serializeElements(elements, options);
},
getElements: function(form) {
@@ -2808,6 +2823,11 @@
return element.value;
},
+ //[SERIALIZE_ERROR]
+ button: function(element) {
+ return element.value;
+ },
+
select: function(element) {
return this[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
Show replies by date