From e55f429bb5d2f5e2d219de1e4d55da04703014d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 16 Dec 2020 21:28:04 +0100 Subject: [PATCH] Test instance to clear search form entries Since rev 2e49820602fb the entries have no more a type attribute. issue9920 review322811002 --- src/screen.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/screen.js b/src/screen.js index 57360bfec6..7f4a7acee5 100644 --- a/src/screen.js +++ b/src/screen.js @@ -561,17 +561,12 @@ if (this.last_search_text.trim() !== this.get_text().trim()) { for (var j = 0; j < this.search_form.fields.length; j++) { var fentry = this.search_form.fields[j][1]; - switch(fentry.type) { - case 'selection': - fentry.set_value([]); - break; - case 'date': - case 'datetime': - case 'time': - fentry.set_value(null, null); - break; - default: - fentry.val(''); + if (fentry instanceof Sao.ScreenContainer.Selection) { + fentry.set_value([]); + } else if (fentry instanceof Sao.ScreenContainer.Between) { + fentry.set_value(null, null); + } else { + fentry.val(''); } } this.search_form.fields[0][2].focus();