From 549c46761e2d2924204bae5937f711231c450a0c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 18 May 2019 21:20:26 +0200 Subject: [PATCH] enable data-action/data-method for non-form forms --- Views/FormView.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Views/FormView.js b/Views/FormView.js index 9b51c9d..f152610 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -487,8 +487,21 @@ export class FormView { return; } - this.method = typeof e.attributes['method'] !== 'undefined' ? e.attributes['method'].value : 'EMPTY'; - this.action = typeof e.getAttribute('action') !== 'undefined' ? e.getAttribute('action') : 'EMPTY'; + if (typeof e.attributes['method'] !== 'undefined') { + this.method = e.attributes['method'].value; + } else if (typeof e.attributes['data-method'] !== 'undefined') { + this.method = e.attributes['data-method'].value; + } else { + this.method = 'EMPTY'; + } + + if (typeof e.attributes['action'] !== 'undefined') { + this.action = e.attributes['action'].value; + } else if (typeof e.attributes['data-action'] !== 'undefined') { + this.action = e.attributes['data-action'].value; + } else { + this.action = 'EMPTY'; + } const elements = this.getFormElements(), length = elements.length;