collective / rapido.core

2 stars 2 forks source link

buttons don't submit via ajax #14

Closed djay closed 8 years ago

djay commented 8 years ago

the following fixes it

diff --git a/src/rapido/plone/browser/rapido.js b/src/rapido/plone/browser/rapido.js
index c303cae..0f779bb 100644
--- a/src/rapido/plone/browser/rapido.js
+++ b/src/rapido/plone/browser/rapido.js
@@ -25,7 +25,7 @@ require([
             var self = this;
             var ajax_submit = function(event){
                 var formData = self.$el.serializeArray();
-                if(this.prop("tagName")=='INPUT') {
+                if(this.prop("tagName")=='INPUT' || this.prop("tagName")=='BUTTON' ) {
                     formData.push({
                         name: this.attr('name'),
                         value: this.val()
@@ -48,7 +48,7 @@ require([
                 return false;
             };
             self.$el.submit(ajax_submit.bind(self.$el));
-            self.$el.find('input[type=submit]').each(function(i, el) {
+            self.$el.find(':submit').each(function(i, el) {
                 $(el).click(ajax_submit.bind($(el)));
             });
         },
ebrehault commented 8 years ago

right

ebrehault commented 8 years ago

fixed by https://github.com/plomino/rapido.plone/commit/772ea72726296ebed1595a949675c3d29923eed6 (next time, do a PR directly, you have full access rights on rapido.* repos)

djay commented 8 years ago

ah cool. thanks a lot. Will do a PR.