From 8511f1f7ef6b8a3c191320ac7b15c0ad6fc52ef0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Wed, 15 Apr 2015 18:14:26 +0200 Subject: [PATCH] Fix the data-role parameter --- htdocs/core/class/html.formother.class.php | 8 ++++++-- htdocs/core/lib/ajax.lib.php | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index b7971d52c53..9de656fc44e 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -362,8 +362,12 @@ class FormOther if ($conf->use_javascript_ajax) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out.= ajax_combobox($htmlname); - $nodatarole=' data-role="none"'; + $htmlforcombo = ajax_combobox($htmlname); + if ($htmlforcombo) + { + $out.= $htmlforcombo; + $nodatarole=' data-role="none"'; + } } // Select each sales and print them in a select input $out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index c891ee60a26..7508c214d83 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -314,7 +314,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) * @param string $htmlname Name of html select field * @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete - * @return string Return html string to convert a select field into a combo + * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. */ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) { @@ -323,8 +323,8 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) if (! empty($conf->dol_use_jmobile)) return ''; // combobox with jmobile (does not works) if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; - if (empty($conf->use_javascript_ajax)) return ''; - + if (empty($conf->use_javascript_ajax)) return ''; + /* Some properties for combobox: minLengthToAutocomplete: 2, comboboxContainerClass: "comboboxContainer", -- GitLab