forked from Wavyzz/dolibarr
Test: search company with jQuery
This commit is contained in:
@@ -561,6 +561,8 @@ class Form
|
||||
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (select_societes) -->'."\n";
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding">';
|
||||
print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
|
||||
print '<div class="ui-widget">';
|
||||
if ($socid == 0)
|
||||
{
|
||||
//$langs->load("companies");
|
||||
@@ -570,7 +572,8 @@ class Form
|
||||
{
|
||||
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
|
||||
}
|
||||
print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
|
||||
print '</div>';
|
||||
//print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
|
||||
print '</td>';
|
||||
//print '<td class="nobordernopadding" align="left" width="16">';
|
||||
//print ajax_indicator($htmlname,'working'); // Indicator is here
|
||||
|
||||
@@ -94,8 +94,8 @@ function ajax_autocompleter($selected='',$htmlname,$value,$url,$indicator='worki
|
||||
source: "'.$url.'",
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
jQuery("#'.$htmlname.'").val(ui.item.value);
|
||||
jQuery("#'.$value.'").val(ui.item.id);
|
||||
jQuery("#'.$htmlname.'").val(ui.item.socname);
|
||||
jQuery("#'.$value.'").val(ui.item.socid);
|
||||
}
|
||||
});
|
||||
});';
|
||||
|
||||
@@ -82,9 +82,9 @@ if (! empty($_POST['newcompany']) || ! empty($_GET['term']) || ! empty($_POST['i
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
$row_array['id'] = $row['rowid'];
|
||||
$row_array['value'] = $row['nom'];
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
$row_array['socname'] = $row['nom'];
|
||||
$row_array['socid'] = $row['rowid'];
|
||||
|
||||
array_push($return_arr,$row_array);
|
||||
}
|
||||
|
||||
@@ -1465,6 +1465,10 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
||||
/* Ajax - Liste deroulante de l'autocompletion */
|
||||
/* ============================================================================== */
|
||||
|
||||
.ui-autocomplete-loading {
|
||||
background: white url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/working.gif' ?>) right center no-repeat;
|
||||
}
|
||||
|
||||
div.autocomplete {
|
||||
position:absolute;
|
||||
width:250px;
|
||||
|
||||
Reference in New Issue
Block a user