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( return $this->createRelatedAction(
'add', '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'), $this->translate('Add a new entry'),
'plus' 'plus'
); );

View File

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