mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-15 08:48:42 +00:00
form bug fixes
This commit is contained in:
parent
7762df4fd2
commit
e126150e0f
|
|
@ -198,8 +198,16 @@ export class Form
|
||||||
jsOMS.preventAll(event);
|
jsOMS.preventAll(event);
|
||||||
|
|
||||||
const remove = self.forms[id].getRemove()[elementIndex];
|
const remove = self.forms[id].getRemove()[elementIndex];
|
||||||
const callback = function (response, xhr) {
|
const callback = function (xhr) {
|
||||||
if (xhr.status !== 200) {
|
if (xhr.status !== 200) {
|
||||||
|
self.app.notifyManager.send(
|
||||||
|
new NotificationMessage(
|
||||||
|
NotificationLevel.ERROR,
|
||||||
|
'Failure',
|
||||||
|
'Some failure happened'
|
||||||
|
), NotificationType.APP_NOTIFICATION
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,24 +221,31 @@ export class Form
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @var {Element} formElement Form element */
|
/** @var {Element} formElement Form element */
|
||||||
const formElement = self.forms[id].getFormElement();
|
const formElement = document.getElementById(id).getAttribute('action') !== null || document.getElementById(id).getAttribute('data-action') !== null
|
||||||
|
? self.forms[id].getFormElement()
|
||||||
|
: (
|
||||||
|
document.getElementById(id).getAttribute('data-update-form') !== null
|
||||||
|
? self.forms[document.getElementById(id).getAttribute('data-update-form')].getFormElement()
|
||||||
|
: (
|
||||||
|
document.getElementById(id).getAttribute('data-delete-form') !== null
|
||||||
|
? self.forms[document.getElementById(id).getAttribute('data-delete-form')].getFormElement()
|
||||||
|
: null
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Perform the element deletion.
|
// Perform the element deletion.
|
||||||
// If the form has a remote endpoint this is called in advance
|
// If the form has a remote endpoint this is called in advance
|
||||||
if (formElement !== null
|
if (formElement !== null) {
|
||||||
&& ((formElement.tagName.toLowerCase() !== 'form' && formElement.getAttribute('data-method') !== null)
|
|
||||||
|| (formElement.tagName.toLowerCase() === 'form' && formElement.getAttribute('method') !== 'NONE'))
|
|
||||||
) {
|
|
||||||
const deleteRequest = new Request(
|
const deleteRequest = new Request(
|
||||||
formElement.hasAttribute('data-method-delete')
|
formElement.hasAttribute('data-action-delete')
|
||||||
? formElement.getAttribute('data-method-delete')
|
? formElement.getAttribute('data-action-delete')
|
||||||
: (formElement.tagName.toLowerCase() !== 'form'
|
: (formElement.tagName.toLowerCase() !== 'form'
|
||||||
? formElement.getAttribute('data-method')
|
? formElement.getAttribute('data-action')
|
||||||
: formElement.getAttribute('method')
|
: formElement.getAttribute('action')
|
||||||
),
|
),
|
||||||
RequestMethod.DELETE
|
RequestMethod.DELETE
|
||||||
);
|
);
|
||||||
deleteRequest.setSuccess(callback);
|
deleteRequest.setResultCallback(0, callback);
|
||||||
deleteRequest.send();
|
deleteRequest.send();
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,11 @@ export class Tab
|
||||||
activateTabUri (e)
|
activateTabUri (e)
|
||||||
{
|
{
|
||||||
const fragmentString = window.location.href.includes('#') ? HttpUri.parseUrl(window.location.href).fragment : '';
|
const fragmentString = window.location.href.includes('#') ? HttpUri.parseUrl(window.location.href).fragment : '';
|
||||||
|
|
||||||
|
if (fragmentString === null || typeof fragmentString === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fragments = fragmentString.split('&');
|
const fragments = fragmentString.split('&');
|
||||||
const fragLength = fragments.length;
|
const fragLength = fragments.length;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user