enable data-action/data-method for non-form forms

This commit is contained in:
Dennis Eichhorn 2019-05-18 21:20:26 +02:00
parent dd974071d7
commit 549c46761e

View File

@ -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;