$limit = '';
if (isset($_POST[$select_submit])) {
-
if ($by_id) $txt = $_POST[$name];
if (!$opts['async'])
$rel = "rel='$search_box'"; // set relation to list
if ($opts['search_submit']) {
if (isset($_POST[$search_submit])) {
+ $selected_id = ''; // ignore selected_id while search
if (!$opts['async'])
$Ajax->activate('_page_body');
else
$descr = $opts['format']==null ? $contact_row[1] :
call_user_func($opts['format'], $contact_row);
$sel = '';
- if ((string)($selected_id) === $value) {
+ if (get_post($search_submit) && ($txt === $value)) {
+ $selected_id = $value;
+ }
+ if ((string)($selected_id) === $value) {
$sel = 'selected';
$found = $value;
- }
+ }
if ($first_id === false) {
$first_id = $value;
$first_opt = $descr;
$_POST[$name] = $selected_id;
if ($by_id && $search_box != false) {
- $txt = $_POST[$name];
- $Ajax->addUpdate($name, $search_box, $txt);
+ $txt = $found;
+ $Ajax->addUpdate($name, $search_box, $txt ? $txt : '');
}
$selector = "<select $disabled name='$name' class='$class' title='"
. $opts['sel_hint']."' $rel>".$selector."</select>\n";
return $str;
}
+
+/*
+ Helper function.
+ Returns true if selector $name is subject to update.
+*/
+function list_updated($name)
+{
+ return isset($_POST['_'.$name.'_update']) || isset($_POST['_'.$name.'_button']);
+}
//----------------------------------------------------------------------------------------------
// Universal array combo generator
// $items is array of options 'value' => 'description'