mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
form bug fixes
This commit is contained in:
parent
6c87d85a6d
commit
5252b76ef3
|
|
@ -320,9 +320,12 @@ export class Request
|
|||
this.type = type;
|
||||
this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type);
|
||||
|
||||
/*
|
||||
@todo: why was i doing this?
|
||||
if (this.type === RequestType.FORM_DATA) {
|
||||
delete this.requestHeader['Content-Type'];
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -374,7 +377,16 @@ export class Request
|
|||
const self = this;
|
||||
|
||||
if (this.xhr.readyState !== 1) {
|
||||
if (this.type === RequestType.FORM_DATA) {
|
||||
let url = this.uri;
|
||||
for (let pair of this.data.entries()) {
|
||||
url += '&' + pair[0] + '=' + pair[1];
|
||||
}
|
||||
|
||||
this.xhr.open(this.method, UriFactory.build(url));
|
||||
} else {
|
||||
this.xhr.open(this.method, UriFactory.build(this.uri));
|
||||
}
|
||||
|
||||
for (const p in this.requestHeader) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.requestHeader, p) && this.requestHeader[p] !== '') {
|
||||
|
|
@ -409,7 +421,11 @@ export class Request
|
|||
} else if (this.type === RequestType.URL_ENCODE) {
|
||||
this.xhr.send(this.queryfy(this.data));
|
||||
} else if (this.type === RequestType.FORM_DATA) {
|
||||
if (this.method === RequestMethod.GET) {
|
||||
this.xhr.send();
|
||||
} else {
|
||||
this.xhr.send(this.data);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -796,7 +796,9 @@ export class Form
|
|||
|
||||
// define remote response behavior
|
||||
self.forms[externalFormId].setSuccess(function (response) {
|
||||
if (response.get('status') !== 'undefined' && response.get('status') !== NotificationLevel.HIDDEN) {
|
||||
if (response.get('status') !== 'undefined'
|
||||
&& response.get('status') !== NotificationLevel.HIDDEN
|
||||
) {
|
||||
self.app.notifyManager.send(
|
||||
new NotificationMessage(response.get('status'), response.get('title'), response.get('message')), NotificationType.APP_NOTIFICATION
|
||||
);
|
||||
|
|
@ -810,7 +812,9 @@ export class Form
|
|||
Form.setDataFromRemoteUrls(remoteUrls);
|
||||
});
|
||||
}
|
||||
} else if ((elementIndex = Array.from(self.forms[id].getSubmit()).indexOf(event.target)) !== -1) {
|
||||
} else if ((elementIndex = Array.from(self.forms[id].getSubmit()).indexOf(event.target)) !== -1
|
||||
|| (elementIndex = Array.from(self.forms[id].getSubmit()).indexOf(event.target.parentNode)) !== -1
|
||||
) {
|
||||
jsOMS.preventAll(event);
|
||||
self.submit(self.forms[id], self.forms[id].getSubmit()[elementIndex]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ export class Table
|
|||
{
|
||||
sorting.addEventListener('click', function (event)
|
||||
{
|
||||
if (this.firstElementChild.tagName.toLowerCase() === 'a') {
|
||||
if (this.firstElementChild === null || this.firstElementChild.tagName.toLowerCase() === 'a') {
|
||||
// page is getting reloaded
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,10 +81,9 @@ export class GeneralUI
|
|||
|
||||
if (input !== null) {
|
||||
input.click();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
jsOMS.preventAll(event);
|
||||
history.pushState(null, null, window.location);
|
||||
|
|
@ -92,7 +91,10 @@ export class GeneralUI
|
|||
let uri = this.getAttribute('data-href');
|
||||
uri = uri === null ? this.getAttribute('href') : uri;
|
||||
|
||||
if (this.getAttribute('target') === '_blank' || this.getAttribute(['data-target']) === '_blank' || event.button === 1) {
|
||||
if (this.getAttribute('target') === '_blank'
|
||||
|| this.getAttribute(['data-target']) === '_blank'
|
||||
|| event.button === 1
|
||||
) {
|
||||
window.open(UriFactory.build(uri), '_blank');
|
||||
} else {
|
||||
window.location = UriFactory.build(uri);
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ export class UriFactory
|
|||
}
|
||||
}
|
||||
|
||||
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9\-\#\.]*\}', 'g'), function (match) {
|
||||
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9_\\-#\.]*\}', 'g'), function (match) {
|
||||
match = match.substr(1, match.length - 2);
|
||||
|
||||
if (toMatch !== null && Object.prototype.hasOwnProperty.call(toMatch, match)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user