From dcc262b64e58bc45a6b73519b2dde1e44d867912 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 22 Apr 2019 16:29:28 +0200 Subject: [PATCH] Fix action uri --- Message/Request/Request.js | 4 ++++ Views/FormView.js | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Message/Request/Request.js b/Message/Request/Request.js index b7ba53e..30844ad 100644 --- a/Message/Request/Request.js +++ b/Message/Request/Request.js @@ -345,6 +345,10 @@ export class Request { */ send() { + if (this.uri === '') { + return; + } + const self = this; if (this.xhr.readyState !== 1) { diff --git a/Views/FormView.js b/Views/FormView.js index a777873..e58dea5 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -286,6 +286,17 @@ export class FormView { } } + // Create FormData + /* todo: implement once we know how to handle this in the backend/php + const formData = new FormData(), + dataLength = data.length; + + for (let key in data) { + if (data.hasOwnProperty(key)) { + formData.append(key, data[key].constructor === Array ? JSON.stringify(data[key]) : data[key]); + } + } */ + return data; }; @@ -395,7 +406,7 @@ export class FormView { } this.method = typeof e.attributes['method'] !== 'undefined' ? e.attributes['method'].value : 'EMPTY'; - this.action = typeof e.action !== 'undefined' ? e.action : 'EMPTY'; + this.action = typeof e.getAttribute('action') !== 'undefined' ? e.getAttribute('action') : 'EMPTY'; const elements = this.getFormElements(), length = elements.length;