ExtensibleSet: fix "remove" button handling

fixes #1100
This commit is contained in:
Thomas Gelf 2017-10-04 06:56:11 +02:00
parent 45eaf0e987
commit 5c53f9a3ba
2 changed files with 12 additions and 7 deletions

View File

@ -467,7 +467,10 @@ class ExtensibleSetElement extends BaseElement
{
return $this->createRelatedAction(
'add',
$this->name,
// This would interfere with how PHP resolves _POST arrays. So we
// use a fake name for now, that way the button will be ignored and
// behave similar to an auto-submission
'X_' . $this->name,
$this->translate('Add a new entry'),
'plus'
);

View File

@ -505,16 +505,18 @@
ev.preventDefault();
ev.stopPropagation();
return false;
} else if (el.name.match(/__MOVE_REMOVE$/)) {
// TODO: skipping for now, wasn't able to prevent web2 form
// submission once removed
/*
var $li = $(el).closest('li').remove();
} else if (el.name.match(/__REMOVE$/)) {
$li = $(el).closest('li');
if ($li.find('.autosubmit').length) {
// Autosubmit element, let the server handle this
return true;
}
$li.remove();
this.fixRelatedActions($li.closest('ul'));
ev.preventDefault();
ev.stopPropagation();
return false;
*/
} else if (el.name.match(/__DROP_DOWN$/)) {
ev.preventDefault();
ev.stopPropagation();