diff --git a/js/utils.js b/js/utils.js
index ad54692bb..c2e09a605 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -196,7 +196,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId, sEx
oDiv.append(data);
oDiv.unblock();
oDiv.parent().resize(); // Inform the parent that the form has just been (potentially) resized
- oDiv.find('form').triggerHandler('itop.search.form.reloaded');
+ oDiv.find('form.search_form_handler').triggerHandler('itop.search.form.reloaded');
}
);
}
diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php
index 9d43dcdc6..edf54a3be 100644
--- a/sources/application/search/searchform.class.inc.php
+++ b/sources/application/search/searchform.class.inc.php
@@ -17,6 +17,7 @@ use AttributeTagSet;
use CMDBObjectSet;
use Combodo\iTop\Application\Search\CriterionConversion\CriterionToSearchForm;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
+use Combodo\iTop\Application\UI\Base\Component\Form\FormUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
@@ -64,44 +65,33 @@ class SearchForm
}
// Simple search form
- if (isset($aExtraParams['currentId']))
- {
+ if (isset($aExtraParams['currentId'])) {
$sSearchFormId = 'sf_'.$aExtraParams['currentId'];
- }
- else
- {
+ } else {
$iSearchFormId = utils::GetUniqueId();
$sSearchFormId = 'SimpleSearchForm'.$iSearchFormId;
$oUiBlock->AddHtml("
");
$aListParams['currentId'] = "$iSearchFormId";
}
// Check if the current class has some sub-classes
- if (isset($aExtraParams['baseClass']))
- {
+ if (isset($aExtraParams['baseClass'])) {
$sRootClass = $aExtraParams['baseClass'];
- }
- else
- {
+ } else {
$sRootClass = $sClassName;
}
//should the search be opened on load?
- if (isset($aExtraParams['open']))
- {
+ if (isset($aExtraParams['open'])) {
$bOpen = $aExtraParams['open'];
- }
- else
- {
+ } else {
$bOpen = true;
}
$sJson = utils::ReadParam('json', '', false, 'raw_data');
- if (!empty($sJson))
- {
+ if (!empty($sJson)) {
$aListParams['json'] = json_decode($sJson, true);
}
- if (!isset($aExtraParams['result_list_outer_selector']))
- {
+ if (!isset($aExtraParams['result_list_outer_selector'])) {
if (isset($aExtraParams['table_id'])) {
$aExtraParams['result_list_outer_selector'] = $aExtraParams['table_id'];
} else {
@@ -115,16 +105,13 @@ class SearchForm
if (isset($aExtraParams['search_header_force_dropdown'])) {
$sClassesCombo = $aExtraParams['search_header_force_dropdown'];
- $sClassesCombo = str_replace('this.form.submit();', "ReloadSearchForm('$sSearchFormId', this.value, '$sRootClass', '$sContext', '$sOuterSelector', $sJsonExtraParams)", $sClassesCombo);
} else {
$aSubClasses = MetaModel::GetSubclasses($sRootClass);
if (count($aSubClasses) > 0) {
$aOptions = array();
$aOptions[MetaModel::GetName($sRootClass)] = "