Skip to content

Commit

Permalink
Term input fixes (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg authored May 8, 2023
2 parents 6d20102 + a81033b commit 45ab6c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion asset/js/widget/TermInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(["BaseInput"], function (BaseInput) {
define(["../notjQuery", "BaseInput"], function ($, BaseInput) {

"use strict";

Expand All @@ -10,6 +10,17 @@ define(["BaseInput"], function (BaseInput) {
this.ignoreSpaceUntil = null;
}

bind() {
super.bind();

// TODO: Compatibility only. Remove as soon as possible once Web 2.12 (?) is out.
// Or upon any other update which lets Web trigger a real submit upon auto submit.
$(this.input.form).on('change', 'select.autosubmit', this.onSubmit, this);
$(this.input.form).on('change', 'input.autosubmit', this.onSubmit, this);

return this;
}

reset() {
super.reset();

Expand Down
4 changes: 3 additions & 1 deletion src/FormElement/TermInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public function parseValue(string $value): array
$ignoreSeparator = false;
for ($i = 0; $i <= strlen($value); $i++) {
if (! isset($value[$i])) {
$terms[] = rawurldecode($term);
if (! empty($term)) {
$terms[] = rawurldecode($term);
}

break;
}
Expand Down

0 comments on commit 45ab6c2

Please sign in to comment.